Jump to content

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

Edited by Ch0cu3r
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.