Jump to content

MYSQL conversion to MYSQLI help


FUNKAM35

Recommended Posts

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

$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;
}
$link_id = mysql_connect("$db_host","$db_user","$db_password");
if (mysql_select_db("$db_database", $link_id));
else
{
echo "connection failed.";
}

I am having to update MySQL to mysqli as my host is upgrading to PHP5.6

 

I have managed to convert and connect to the database

 

 

 

converted to

 

 

 

I cannot get the fetch results to work, can anyone help me convert the following code

 

 

Many Thanks

Link to comment
https://forums.phpfreaks.com/topic/297364-mysql-conversion-to-mysqli-help/
Share on other sites

Code for fetching the results will be

$results = $mysqli->query($link_id, $select);
while ($query_data = $results->fetch_row()))
{

See respective manual pages on mysqli here

http://php.net/mysqli

http://php.net/mysqli.query

http://php.net/mysqli-result.fetch-row

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.