- Код: Выделить всё • Развернуть
$all_sql = "SELECT count(*) FROM article WHERE key='1'";
$all_res = mysql_query($all_sql) or die(mysql_error());;
$all_row = mysql_fetch_row($all_res);
$sql = "SELECT * FROM article WHERE key='1' LIMIT ".$all_row[0];
$res = mysql_query($sql) or die(mysql_error());
for($i=0; $i<$all_row[0]; $i++){
$row = mysql_fetch_array($res);
if($row){
echo $row['title']; // do somthing else
}
}