SQL Query
Posted: Thu Feb 28, 2019 10:48 pm
Need some help from someone who knows .PHP
The code I have below works on an older version of .php however our web hosting company is planning to upgrade to the latest version of .php. This code does not work on the latest release. Can someone help me fix it? Thanks!
<Database Connection Call Appears Here>
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Oops some thing went wrong");
mysql_select_db($mysql_database, $bd) or die("Oops some thing went wrong");// we are now connected to database
$result = mysql_query("SELECT * FROM `OklahomaNRA` WHERE `id` ORDER BY RAND() LIMIT 15"); // selecting data through mysql_query()
echo '<table border=0px>'; // opening table tag
echo'<th>Subject</th><th>Url</th>'; //table headers
while($data = mysql_fetch_array($result))
{
// we are running a while loop to print all the rows in a table
echo '<table style="font-size:12px; font-family:Arial; color:black;">';
echo'<tr>'; // printing table row
echo '<td>'.$data['Subject'].'</td><td><a href="'.$data['Url'].'">'.$data['Url'].'</a></td></td> '; // we are looping all data to be printed till last row in the table
echo'</tr>'; // closing table row
}
?>
The code I have below works on an older version of .php however our web hosting company is planning to upgrade to the latest version of .php. This code does not work on the latest release. Can someone help me fix it? Thanks!
<Database Connection Call Appears Here>
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Oops some thing went wrong");
mysql_select_db($mysql_database, $bd) or die("Oops some thing went wrong");// we are now connected to database
$result = mysql_query("SELECT * FROM `OklahomaNRA` WHERE `id` ORDER BY RAND() LIMIT 15"); // selecting data through mysql_query()
echo '<table border=0px>'; // opening table tag
echo'<th>Subject</th><th>Url</th>'; //table headers
while($data = mysql_fetch_array($result))
{
// we are running a while loop to print all the rows in a table
echo '<table style="font-size:12px; font-family:Arial; color:black;">';
echo'<tr>'; // printing table row
echo '<td>'.$data['Subject'].'</td><td><a href="'.$data['Url'].'">'.$data['Url'].'</a></td></td> '; // we are looping all data to be printed till last row in the table
echo'</tr>'; // closing table row
}
?>