PHP Classes

need help in converting deprecated php code to php 7.2

Recommend this page to a friend!

      PHP MySQL to MySQLi  >  PHP MySQL to MySQLi package blog  >  How to Convert MySQL ...  >  All threads  >  need help in converting deprecated...  >  (Un) Subscribe thread alerts  
Subject:need help in converting deprecated...
Summary:replaced all "mysql" instances with "mysql1" but not working yet
Messages:3
Author:jack walroth
Date:2019-02-23 01:15:00
 

  1. need help in converting deprecated...   Reply   Report abuse  
Picture of jack walroth jack walroth - 2019-02-23 01:15:00
<?
// sept 17 2011
// cloud connect script

$server="mariadb-080.wc2.phx1.stabletransit.com";
$username="618547_jaxADMIN1";
$password="jaxLSMS1818";
$database="618547_jax78s";
$db = mysqli_connect($server, $username, $password);
mysqli_select_db($database,$db);


$db = mysqli_connect("mariadb-080.wc2.phx1.stabletransit.com", "618547_jaxADMIN1", "jaxLSMS1818");
mysqli_select_db("618547_jax78s",$db);
$result = mysqli_query("SELECT * FROM forsale",$db);
echo "<table border=3>\n";

while ($myrow = mysqli_fetch_row($result)) {
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>
<td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$myrow[1], $myrow[2], $myrow[3], $myrow[4], $myrow[5], $myrow[6], $myrow[7], $myrow[8], $myrow[9] );
}
echo "</table>\n";
?>
</body>
</html>

  2. Re: need help in converting deprecated...   Reply   Report abuse  
Picture of Dave Smith Dave Smith - 2019-02-23 01:33:45 - In reply to message 1 from jack walroth
mySQLi uses the link as the first property in methods that require the link, so...

mysqli_select_db("618547_jax78s",$db);

should be...

mysqli_select_db($db,"618547_jax78s");

and...

$result = mysqli_query("SELECT * FROM forsale",$db);

should be...

$result = mysqli_query($db,"SELECT * FROM forsale");

Also, if these are the real credentials to access your database you will need to immediately change the user and password since you have publicly posted them here.

Dave

  3. Re: need help in converting deprecated...   Reply   Report abuse  
Picture of jack walroth jack walroth - 2019-02-23 03:10:42 - In reply to message 1 from jack walroth
Thanks Dave,
I appreciate your response and will go ahead and try this with my code.
Not quite the real credentials, thanks for warning.
best regards,
Jack