nerd99 Posted June 29, 2010 Share Posted June 29, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/206148-how-do-i-replace-mysqli-with-mysql-please-help/ Share on other sites More sharing options...
trq Posted June 29, 2010 Share Posted June 29, 2010 mysql_query expects the first argument to be a string containing your query. mysqli_query on the other hand expects your connection resource. If your host doesn't support mysqli I would switch hosts to be honest. Its a fairly standard extension. Quote Link to comment https://forums.phpfreaks.com/topic/206148-how-do-i-replace-mysqli-with-mysql-please-help/#findComment-1078588 Share on other sites More sharing options...
nerd99 Posted June 29, 2010 Author Share Posted June 29, 2010 Thanks Thorpe, much appreciated. This was my suspicion. How annoying! Can you recommend any hosting services? Quote Link to comment https://forums.phpfreaks.com/topic/206148-how-do-i-replace-mysqli-with-mysql-please-help/#findComment-1078590 Share on other sites More sharing options...
Mchl Posted June 29, 2010 Share Posted June 29, 2010 Why don't you find a hosting that supports mysqli instead? If they don't support such basic extension, what happens if you need something more elaborate? Quote Link to comment https://forums.phpfreaks.com/topic/206148-how-do-i-replace-mysqli-with-mysql-please-help/#findComment-1078599 Share on other sites More sharing options...
luca200 Posted June 29, 2010 Share Posted June 29, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/206148-how-do-i-replace-mysqli-with-mysql-please-help/#findComment-1078671 Share on other sites More sharing options...
Potatis Posted June 29, 2010 Share Posted June 29, 2010 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) Quote Link to comment https://forums.phpfreaks.com/topic/206148-how-do-i-replace-mysqli-with-mysql-please-help/#findComment-1078676 Share on other sites More sharing options...
Potatis Posted June 29, 2010 Share Posted June 29, 2010 If you don't find a host by Thursday, I am happy to host your trial, with a different domain name. Quote Link to comment https://forums.phpfreaks.com/topic/206148-how-do-i-replace-mysqli-with-mysql-please-help/#findComment-1078683 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.