mysql到mysqli的转换结果

时间:2015-07-19 09:59:49

标签: php mysql mysqli

我必须将MySQL更新为mysqli,因为我的主机正在升级到PHP5.6

我已设法转换并连接到数据库,如下所示

 $link_id = mysql_connect("$db_host","$db_user","$db_password");
 if (mysql_select_db("$db_database", $link_id));
 else
 {
         echo "connection failed.";
 }

转换为

$link_id = mysqli_connect("$db_host","$db_user","$db_password","$db_database");
if ($mysqli->connect_errno) {
  echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}

我无法获取获取结果,任何人都可以帮我转换以下代码

$results = mysql_query("$select", $link_id);
while ($query_data = mysql_fetch_row($results))
{

非常感谢

0 个答案:

没有答案