Here is the piece of code I use when I need to loop through several mysql rows (I use arrays just in case I have to do an improbable nested query) :
So, my question is : is there a way to do the same thing with less code?
Thanks.
Code:
$sql_query[1] = "SELECT ____ ";
$sql_query[1] .= "FROM ____ ";
$sql_query[1] .= "WHERE ____ ";
$sql_query[1] .= "AND ____ ";
$sql_query[1] .= "GROUP BY ____ ";
$sql_query[1] .= "ORDER BY ____ ";
$sql_query[1] .= "ASC";
$sql_result[1] = mysql_query($sql_query[1],$db_connect);
$sql_num[1] = mysql_num_rows($sql_result[1]);
if($sql_num[1] > 0) {
$cur[1] = 1;
while ($sql_num[1] >= $cur[1]) {
$row = mysql_fetch_array($sql_result[1]);
$____ = $row["____"];
echo"
" . $____ . "<br />
";
$cur[1]++;
}
}
So, my question is : is there a way to do the same thing with less code?
Thanks.