After a PHP upgrade MYSQL will no longer work without displaying errors so many webmasters are being forced to switch to MYSQLi. This can be a scary and daunting task but once you get into it the job moves along at quite a pace.

The basis is quite simply a small change in code:

With MYSQL you may have something like this:

With MYSQLi you would end up with this;

The only difference is the inclusion of the 'i' wherever you have mysql. (This can easily be done with Find and Replace)

Add the $database to $connection you then no longer need the line beginning $db = mysql_select_db

Split the line

$result = mysql_query("SELECT * FROM table") or die(mysql_error());


$query = "SELECT * FROM table";
$result = mysqli_query($connection,$query);

Of course PHP and mysql is a complex and wide ranging subject but I hope that this shows you that convertion is not that difficult to do.

Keith Hirst

let your thoughts soar higher and you will see clear like an Eangle
Allow your thoughts to soar higher!.

Accept Cookies?