I have a database and i want to sort results like this:
$query1 = "SELECT * FROM pictures LIMIT 0,10 ";
$result = mysql_query($query1);
while($row = mysql_fetch_array($result))
echo $row['picture_rating'];
and
$query1 = "SELECT * FROM pictures WHERE column_name = 'column_text' ";
$result = mysql_query($query1);
while($row = mysql_fetch_array($result))
echo $row['picture_rating'];
Both of the codes above are working properly, but when i want to use both condition at one time like this:
$query1 = "SELECT * FROM pictures LIMIT 0,10 WHERE column_name = 'column_text' ";
it doesnt work. Any ideas how to make it work? Thanx!
SOLVED: Information that LIMIT should be after WHERE was exactly what i needed. Thanx to all.
the SQL syntax for SELECT defines that LIMIT should be after WHERE
see http://dev.mysql.com/doc/refman/5.0/en/select.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With