-1
I’m using this code:
<php?
$sql = mysql_query("SELECT `id`, `detail`, `time` FROM `news` ORDER BY `time` DESC LIMIT 5");
$return = mysql_fetch_assoc($sql);
while($row = $return) { ?>
Data: <?php echo date("d/m/Y", $row['time']); ?> |
Noticia: <?php echo $row['detail']; } ?>
And when I run this code, the page keeps loading and does not return the database information.
Database:
The connection to the database is on another page, I used the require();
to pick up the connection.
Connection:
<?php error_reporting(0); $mysql = mysql_connect('localhost', 'root', ''); mysql_select_db('central');
And the page just loads and returns nothing.
Thank you so much!
Just advice, avoid the use of functions
mysql_*
, usemysqli_*
(note who a letter "i"). I don’t mean that it solves the problem. What you should solve are the answers below. This is just a warning to avoid further problems as these functions have been removed in the latest versions of PHP.– Daniel Omine