Jesús Alain Rodríguez Santos wrote:
I have a query:
$query = mysql_query("SELECT event FROM table WHERE month = 'x' ORDER BY
day ASC");
I have all days of the month insert in day field: 1, 2, 3, 4, 5 ...
when I print the query:
if ($query_r = mysql_fetch_array($query)) {
-^
if( mysql_num_rows( $query_r ) > 0 ) {
while( $currentResult = mysql_fetch_array( $query_r ) ) {
// do something with the result.
}
}
else {
echo 'No results.';
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/un
The following line:
$query_r = mysql_fetch_array($query)
Will pop off the first result from the query, you can avoid this problem by
using mysql_num_rows instead:
if( mysql_num_rows( $query ) > 0 )...
Carlo Razzeto
Programmer
Mortgage Information Services
Phone: (216) 514-1025 ex. 1212
3 matches
Mail list logo