Jump to content

upgrade to PHP 5.5, Site Doesn't work

Recommended Posts

I've been out of coding for about 4 years.  My client called and said that they upgraded his server and now nothing works.  I've don't done some reading and see that there are changes to queries.  I originally wrote the program using mysql_query which is now deprecated replaced with MySQLi and PDO_MySQL which I thought would be that simple.  Apparently not.  My code is below.  The error I get is

Fatal error: Call to undefined function MySQLi() in /home1/zipclick/public_html/marketingteamates.com/_ZABP_merchants/main-w.php on line 304

which leads me to believe that the upgrade is now solely object oriented.  


$result = MySQLi( "SELECT * FROM $users WHERE username = '$username'" )
or die("SELECT Error: ". mysqli_errno());
$num_rows = mysqli_num_rows($result);
 while ($row = mysqli_fetch_array($result))



Share this post

Link to post
Share on other sites
19 minutes ago, TecTao said:

$result = MySQLi( "SELECT * FROM $users WHERE username = '$username'" )

That is not real code. Perhaps the manual will be of help. You will have to break it to your client that his "upgrade" is still hundreds and hundreds of releases behind. The whole bit of the code you posted shows there is quite a bit of work that will need to be done to bring the app up to date. Version 5.5 reached end of life many years ago.


Edited by benanamen

Share this post

Link to post
Share on other sites

it would help to know what the old php version was. just an update to 5.5 (which should have or soon will be an update to 7+) doesn't break the mysql_ functions. it's more likely that the code is dependent on register_globals in order to function. if so, it will take rewriting all the code to use the actual php super global variables where the external $_GET, $_POST, $_FILES, $_COOKIE, and some $_SERVER variables are at. you would also want to update the code to use one of the current database extensions, and since query security also went away in php 5.4, in order to keep from having to add a bunch of code, it is better to switch to use prepared queries, with the php PDO extension, and to use exceptions to handle database statement errors. doing this will result in the simplest php code and simplest sql query syntax, which will reduce the amount of things you have to update, i.e. you can just eliminate a bunch of stuff, rather than to spend time on updating it.

Edited by mac_gyver

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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.