2
I’m trying to insert an Row in mysql but is returning it:
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO
2
I’m trying to insert an Row in mysql but is returning it:
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO
5
mysql_* functions are obsolete since PHP 5.5. Prefer to use Mysqli or PDO (believe me, it will be much more advantageous).
"we should not use functions of the "mysql" extension because its development has been discontinued; the extension will soon become obsolete, ie code using these functions will not work in future versions of PHP."
Why should we not use mysql type functions_*?
Also, mysqli is very similar to mysql_* so you won’t have any problems to learn and migrate your projects. Example:
// Conexão mysql
$db = mysql_connect('localhost', 'mysql_user', 'mysql_password');
// Conexão mysqli
$db = mysqli_connect("localhost","my_user","my_password","my_db");
Mysqli functions end up being newer, faster and safer, have new functions and are object oriented, IE, is an evolution of the mysql extension_*.
There is still another alternative to mysql_* and mysqli, PDO. It allows working multiple databases and has Prepared statements (that is not so fast, but much safer).
Even though the PDO has been criticized for bringing more problems than solutions. In my opinion, I would choose it because it supports more BD drivers and because it is much safer.
edited the question, and put more information C:
3
Often, when searching for help on internet sites, they give examples as you saw, using old technologies that have already been discontinued.
The mysql_connect()
, and all functions mysql_*
fit into it. They are discontinued, but it does not mean that all the tutorial sites have been updated.
You will want to use, as already explained, the new form:
$db = mysqli_connect(...); // Repara o i depois do mysql
Browser other questions tagged php mysql
You are not signed in. Login or sign up in order to post.
u must exchange mysql_* functions for mysqi or PDO. You have some answers, with PDO, with Mysqli
– rray