$query = "SELECT * FROM pass";
$result = mysql_query($query,$conn);
echo mysql_num_rows($result);
while($row = mysql_fetch_array($result))
{
$username = $row['user'];
$password = $row['pass'];
}
Num rows = 12 but while loops only the first one if I use in while $row = mysql_fetch_array(mysql_query("SELECT * FROM pass",$conn))
If i use the first code it gives error after the first row, Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in
mysql_queryinterface. It's awful and has been removed in PHP 7. A replacement like PDO is not hard to learn and a guide like PHP The Right Way helps explain best practices. Make sure your user parameters are properly escaped or you will end up with severe SQL injection bugs.