I have a script that is written in PHP and MySql. It works well.
However, I think it is now time to convert to MySqli.
I am using: php-5.3.3-14.el6_3.x86_64 and mysql-5.1.66-2.el6_3.x86_64 on CentOS release 6.3 (Final)
I have a global.php file which is called in my add.php page
My global.php contains:
PHP Code:
//connect to the database
if(!($link=mysql_pconnect($hostName, $userName, $password))){
displayErrMsg(sprintf("Error connecting to the host %s, by user %s", $hostName, $userName));
exit();
}
//select the database
if(!mysql_select_db($databaseName, $link)){
displayErrMsg(sprintf("Error in selecting the %s database", $databaseName));
displayErrMsg(sprintf("error: %d %s", mysql_errno($link), mysql_error($link)));
exit();
}
My add.php page contains:
PHP Code:
$qry = "INSERT INTO " . $vars["table directory"] . " "; etc...
and
if(!($results = mysql_query($qry, $link))){
displayErrMsg(sprintf("Error in executing %s query", $qry));
displayErrMsg(sprintf("error:%d %s", mysql_errno($link), mysql_error($link)));
exit();
}
Can anybody advice if it is a straight forward job to convert ???
I have a few scripts, that were written over the years, that could do with converting.
Thanks,