I have been told that the mysql_
extension is now deprecated in the current version of PHP and will be removed at some point.
What should I use instead of this and how?
For nearly all my queries I use it.
For example:
$result = mysql_query($query);
if (!$result) die ("Database access failed: " . mysql_error());
$rows = mysql_num_rows($result);
Answer
According to the PHP
Manual, you should use any of the following:
To be clear though, neither of these is a mere substitute for mysql_num_rows()
. Your code must eventually be rewritten entirely to use the MySQLi or PDO API in lieu of mysql_*()
.
No comments:
Post a Comment