HOME | PHP Tutorial | CSS
facebook icon
AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP
PHP Tutorial

PHP forms
HTML Tutorial

CSS Tutorial

Deprecated: mysql_connect() mysql extension is deprecated and will be removed in the future



I have this error Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in - how to solve it?
My connect.php page is:

Example

<?php

$database="my_database_name";
$mysql_user = "my_mysql_user";
$mysql_password = "1234";
$mysql_host = "localhost";
$mysql_table_prefix = "";

$success = mysql_connect ($mysql_host, $mysql_user, $mysql_password);
if (!$success)
die ("<b>Cannot connect to database, check if username, password and host are correct.</b>");
$success = mysql_select_db ($database);
if (!$success) {
print "<b>Cannot choose database, check if database name is correct.";
die();
}
?>


I have this error deprecated mysql_connect() mysql extension is deprecated how to solve it?


deprecated mysql_connect Deprecated: mysql_connect() mysql extension is deprecated and will be removed - php mysqli

1269. mysqli_num_fields to get number of fields or columns in a result set returned from database
mysqli_num_fields to get number of column from resultset in PHP MYSQLI
https://www.plus2net.com/php_tutorial/mysqli_num_fields.php

1265. mysqli_fetch_field_direct to get field meta data
mysqli_fetch_field_direct to get field meta data in PHP MYSQLI
https://www.plus2net.com/php_tutorial/mysqli_fetch_field_direct.php

3273. Uncaught Error: Call to undefined function MYSQL_NUM_ROWS() in, php mysqli
Uncaught Error: Call to undefined function MYSQL_NUM_ROWS() in php mysqli
https://www.agernic.com/php-mysqli/uncaught-error-call-to-undefined-function-mysql_num_rows().html

3271. How to prevent sql injection in php mysqli, php mysqli
How to prevent sql injection in php mysqli php mysqli
https://www.agernic.com/php-mysqli/how-to-prevent-sql-injection-in-php-mysqli.html

3285. PHP mysqli_connect () Function, sql tutorial
PHP mysqli_connect () Function sql tutorial
https://www.agernic.com/sql-tutorial/php-mysqli-connect-function.html

3272. Mysqli_fetch_array() expects parameter 1 to be mysqli_result boolean given, php mysqli
Mysqli_fetch_array() expects parameter 1 to be mysqli_result boolean given php mysqli
https://www.agernic.com/php-mysqli/mysqli_fetch_array()-expects-parameter-1-to-be-mysqli_result-boolean-given.html

Your add here
PHP lcfirst() function

PHP rtrim() function

PHP print() function

PHP str_replace() function

PHP strlen() function

PHP printf() function

PHP ucwords() function

PHP count() Function

PHP trim() function

PHP ucfirst() function

PHP strtolower() function

PHP isset() Function

PHP strstr() function

PHP str_repeat() function

PHP strrchr() Function

PHP md5() function

Home HTML Tutorial
HTML colors, background, text and border color
HTML table style, HTML border, width and height
HTML - Elements: body, head, title
HTML link tag with example
How to add text, paragraf in HTML