search
HomePHP LibrariesOther librariesTool class for connecting php to mysql
Tool class for connecting php to mysql
<?php
class mysql {
  private $defaultDB = null;
  private $link = null;
  private $sql = null;
  private $bindValue = null;
  public $num_rows = 0;
  public $affected_rows = 0;
  public $insert_id = 0;
  public $queries = 0;
  public function __construct() {
    if(func_num_args()) {
      $argv = func_get_arg(0);
      if(!empty($argv) && is_array($argv)) {
        $this->connect($argv);
        $argv['charset'] = isset($argv['charset']) ? $argv['charset'] : 'utf8';
        $this->setCharset($argv['charset']);
      }
    }
  }

This is a tool class for php to connect to mysql. Friends who need it can download and use

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

What are some very useful class libraries or tool libraries for PHP?What are some very useful class libraries or tool libraries for PHP?

06Jul2016

What are some very useful class libraries or tool libraries for PHP?

Connecting PHP to Databases: MySQL for BeginnersConnecting PHP to Databases: MySQL for Beginners

09Oct2024

It is very important to connect to the MySQL database in PHP. The steps are as follows: Install the MySQL extension. Use the mysqli_connect() function to create a connection. The parameters include the host, user name, password and database name. Use the mysqli_connect_error() function to check whether the connection is successful. Practical case: Get all User, ensure success by querying the database and checking the connection using the mysqli_connect_error() function. By understanding these steps and the examples provided, you can easily connect to a MySQL database in PHP.

C# tool class MySqlHelper for operating MySQLC# tool class MySqlHelper for operating MySQL

10Nov2016

C# tool class MySqlHelper for operating MySQL code sharing

Summary of methods for connecting PHP to MySQLSummary of methods for connecting PHP to MySQL

15Dec2022

This article brings you relevant knowledge about PHP, which mainly introduces the relevant content of the connection between PHP and MySQL. There are three API interfaces for the connection between PHP and MySQL, namely: PHP's MySQL extension, PHP's mysqli extension, PHP Data Object (PDO), let’s take a look at them separately, I hope it will be helpful to everyone.

Introduction to commonly used class libraries for PHP development in WeChat mini programsIntroduction to commonly used class libraries for PHP development in WeChat mini programs

02Jun2023

With the continuous development of mobile Internet, the use of various Apps is becoming more and more common and the scale is getting larger and larger. As an emerging application form, WeChat mini programs are favored by more and more developers. And small programs developed in PHP have also become a trend. Under this trend, the use of common PHP class libraries has become more and more important. In the process of small program development, PHP class libraries are even more indispensable. In this article, we will mainly introduce the common class libraries used in PHP development in WeChat mini programs. 1. Commonly used classes in PHP development in WeChat mini programs

Analyze two methods of connecting PHP to MYSQL (1)_PHP tutorialAnalyze two methods of connecting PHP to MYSQL (1)_PHP tutorial

15Jul2016

Analyze two methods of connecting PHP to MYSQL (1). Mysql can be connected to the web through PHP in two ways, one through php's Mysql-related functions, and the other through php's ODBC-related functions. The relevant functions are as follows: MYSQL function mysql_affected_ro

See all articles