Jump to content

Help - upgrading PHP to v 5.5 errors


Recommended Posts

Hi everyone,

 

I was wondering if someone might be able to help... Our ISP (EuroCenter vACC) is forcing us to upgrade to PHP 5.5 from 5.3. Mysql version is 5.5. As a result of deprecated features, namely the change from MySQL to MySQLi, the website is throwing a load of errors, including failing to display the membership list. I have tried a number of fixes but I'm unable (with my limited technical knowledge) to make it work.

 

I have been able to temporarily downgrade to 5.3 but the ISP will cease to offer this from next week, so any help would be greatly appreciated. There are only a handful of scripts, and below are the dbconnect and membership list, these are the most important functionality we need to get up and running so if you could let me know how I make these PHP 5.5/mysqli compatible I'd be very grateful.

 

Thanks,

 

Pedro

 

<?
 if (! isset($db_open)) { $db_open = TRUE; }
 $host = "host url";
 $user = "user";
 $p[Mod - Happy Thoughts] = "pwd";
 $db_name = "db";
 $contact = "[email protected]";
 if ($db_open) {
 $db = mysql_connect($host, $user, $p[Mod - Happy Thoughts]) or die("Unable to connect to the database, please inform ".$contact);
 mysql_select_db($db_name, $db) or die("Unable to open the database, please inform ".$contact);
 }
?>

 

 

<?
require("db_connect.inc.php");
?>
<? $roster = "roster" ; // the membership roster ?>

---

<? // selecting Visiting Controllers (2)
$r1="SELECT * FROM $roster WHERE stat=2 AND active=1 ORDER BY cid ASC";
$rsql=mysql_query($r1,$db);
$num_rows=mysql_num_rows($rsql); ?><tr>
<td cl[Mod - Happy Thoughts]=row1 colspan="3">
<p align="center"><b>Visiting Controllers</b></td>
</tr>
<? if ($num_rows != 0) { ?>
<tr>
<td cl[Mod - Happy Thoughts]=row2><b>CID</b></td>
<td cl[Mod - Happy Thoughts]=row2><b>Name</b></td>
<td cl[Mod - Happy Thoughts]=row2><b>Sector(s)</b></td>
</tr>
<? while ($a_row=mysql_fetch_array($rsql)) { ?>
<tr>
<td cl[Mod - Happy Thoughts]=row3><? echo "$a_row[cid]"; ?></td>
<td cl[Mod - Happy Thoughts]=row3><? echo "$a_row[name]"; ?></td>
<td cl[Mod - Happy Thoughts]=row3><? echo "$a_row[sector]"; ?></td>
</tr>
<? } ?>
<? } else { ?>
<td colspan="3" cl[Mod - Happy Thoughts]=row4>No data available</td>
<? } ?>


Pedro Diogo

Link to post
Share on other sites

You say there are errors, but what errors?

 

The mysql extension should still be available in PHP 5.5, unless your ISP has disabled or removed it, so there's no need to immediately migrate to mysqli. You should however be aware that as mysql is deprecated, it will be removed at some point in future versions of PHP, so you will have to migrate eventually.

 

Guessing somewhat here, but if the only problem is that PHP is spewing E_DEPRECATED errors all over your log files and you don't like it, then you just need to disable those error messages. There are various configuration files where you can change this, or at run time in your PHP code just use this:

ini_set('error_reporting', E_ALL & ~E_DEPRECATED)

That second field is a bit mask hence the & ~ (to get 'all but not deprecated')

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...