PHP & MySQL – Connect Database Example PHP provides mysqli contruct or mysqli_connect() function to open a database connection. This function takes six parameters and returns a MySQL link identifier on success or FALSE on failure. Syntax $mysqli = new mysqli($host, $username, $passwd, $dbName, $port, $socket); Sr.No. Parameter & Description 1 $host Optional − The […]
Category Archives: php Mysql
PHP & MySQL – Create Database Example PHP uses mysqli query() or mysql_query() function to create or delete a MySQL database. This function takes two parameters and returns TRUE on success or FALSE on failure. Syntax $mysqli->query($sql,$resultmode) Sr.No. Parameter & Description 1 $sql Required – SQL query to create a MySQL database. 2 $resultmode Optional […]
PHP & MySQL – Insert Records Example PHP uses mysqli_query function to insert records in table. This function takes three parameters and returns TRUE on success or FALSE on failure. Syntax mysqli_query ( mysqli $link, string $query, int $resultmode = MYSQLI_STORE_RESULT ) : mixed Sr.No. Parameter & Description 1 $link Required – A link identifier […]