How to check data in mysql using limit ?
When load this code (will check data in row id 2
) , it's echo requests field
Why not echo not requests field
this is test_table:
________________________________
| id | pro_id | requests |
| 1 | 11111 | 0 |
| 2 | 12345 | 0 |
| 3 | 12345 | 0 |
| 4 | 12345 | 1 |
|__5___|__12345___|_____1______|
and this is php code for check data in test_table
<?PHP
include("connect.php");
$i = "0";
$sql = "SELECT * FROM test_table WHERE pro_id = '12345' AND requests != '0' order by id asc limit $i,1";
$query = mysql_query($sql);
$result = mysql_fetch_array($query);
if($result)
echo "requests field";
else
echo "not requests field";
?>