Jump to content

You're browsing the 2004-2023 VATSIM Forums archive. All content is preserved in a read-only fashion.
For the latest forum posts, please visit https://forum.vatsim.net.

Need to find something? Use the Google search below.
PLEASE READ - Webmaster Support Forum
This forum will be retired in the near future. Please direct all queries to our dedicated GitHub support page https://github.com/vatsimnetwork/developer-info/discussions 
Here you can find documentation on our services and we are continuing to migrate pertinent information into the Wiki pages https://github.com/vatsimnetwork/developer-info/wiki

Help - upgrading PHP to v 5.5 errors


Pedro Diogo 985361
 Share

Recommended Posts

Pedro Diogo 985361
Posted
Posted

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 comment
Share on other sites

Luca Benelli
Posted
Posted

Check the mysqli I stead of MySQL commands.... Not sure but I seem to remember having this issue once. Not working much with php recently, sorry.

Luca Benelli - C3 - P2

Link to comment
Share on other sites

Jamie Fox 811029
Posted
Posted

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 comment
Share on other sites

 Share