Jump to content

upgrade to PHP 5.5, Site Doesn't work


TecTao

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))
  {
     extract($row);

}

 

Link to comment
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.

http://php.net/manual/en/mysqli.query.php

Link to comment
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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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