Jump to content

How do I replace mysqli with mysql???? Please help!


nerd99

Recommended Posts

Hi,

 

I'm not sure that this is the right place to post this but I was scared off by the message at the top of the mysql forum and worried that I wouldn't get a response.

 

I have a big problem. I have spent the last 4months developing a web portal using mysqli string queries. Upon uploading it to my host (ixwebhosting.com) I am told that the server does not support mysqli, only mysql.

 

I went through and did a 'Find & Replace' on ALL of my files as advised by ixwebhosting's help centre. Upon re-uploading the site all has gone askew. I can connect to the database but there are mysql errors everywhere.

 

Just trying to get the index page content I have the following error:

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /hsphere/local/home/krismack/inschool.com.au/main_site_home.php on line 5

 

Here is the main_site_home.php

<?php

//Fetch the main site 'home' content from the database

$result = mysql_query($connection,"SELECT * FROM main_site")
or die(mysql_error($connection));

while($row = mysql_fetch_array($result)) {


/* Fetching profile */

$home = $row['home'];

}

echo format_html("<p>$home</p>");

?>

 

What I really need to know is this: have I done this the correct way? Can you just 'Find & Replace' all 'mysqli' with 'mysql' or do they follow completely different commands?

 

This is very stressful, the site is supposed to be up and running in a day with dozens of users waiting to use the site. Can somebody please help! What do I need to do to get this working?

Link to comment
Share on other sites

Why not writing a bunch of 'mysqli_'-named functions by yourself, just to wrap mysql_ ones?

I think that would be better than changing all function calls in your code, especially if you should switch back to mysqli, some day

Link to comment
Share on other sites

Hi nerd99 :)

 

Don't change your code, change your host. I thought every host supported mysqli by now.

 

You can't just change the word "mysqli" to "mysql" and hope it will work. Mysqli has a different syntax, you have to change whole lines, and there is way too much code to change in your project for it to be worth the time. (I know, I have seen most of it... very very fine mysqli code. :) ). I'm not surprised if you are seeing thousands of errors.

 

You need a host that will support the .com.au domain. If dreamhost did that (which they don't), I'd recommend them.

 

Doug (the mad violinist)

Link to comment
Share on other sites

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.