Here's my code, I have a problem with while, because when I run it in WAMP, this happens:
Warning: Mysql_num_rows() expects parameter 1 to be resource
Warning: mysql_fetch_array() expects parameter 1 to be resource
(Full error).
<?php
mysql_select_db("spectrum-solaris",$conex);
$query = mysql_query("SELECT id,name,tittle,body FROM articles ORDER BY id DESC",$conex);
$row = mysql_num_rows($query);
if($row > 0 ){
while($row = mysql_fetch_array($query))
{
?>
<div class ="tematica" >
<p>
<small>Published by <b><a href="user.php"><?= $row['name'] ?></a></b></small>
</p>
<p>
<big><a href="show.php"><?= $row['tittle'] ?></a></big>
</p>
<p>
<b><?=$row['body']?></b>
</p>
</div>
<?php
}
}
mysql_free_result($query);
mysql_close($conex);
mysql_*
functions are deprecated.