Jump to content
Sign in to follow this  
FUNKAM35

MYSQL conversion to MYSQLI help

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

Share this post


Link to post
Share on other sites

Thanks Ch0cu3r tried that and it says Fatal error: Call to a member function query() on a non-object

Share this post


Link to post
Share on other sites

Change $mysqli-> to be $link_id->

Edited by Ch0cu3r

Share this post


Link to post
Share on other sites

Change $mysqli-> to be $link_id->

Eh. I'd go the other way, change your $link_id to be $mysqli. That's more standard and you'd immediately know by looking at the code that $mysqli is probably a MYSQLI object.

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

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