[plug] PHP Problem

Damion Hill dhill at wantree.com.au
Fri Aug 18 11:47:47 WST 2000


G'day Chris,

Why not test the result index before outputting anything?

<?php
$sql = 'SOME SQL QUERY";
$result = mysql_query($sql);
if ($result == 0){
	print ("The selected query, $sql, failed to return a result.\n");
} else {
	while ($myrow = mysql_fetch_array($result)){
		print ("The results go here");
	}
}
?>

On 18 Aug 00, at 11:14, Chris Darby wrote:

> 
> im wondering if anyone can help me, im querying a MySQL database using
> PHP, if there is no data in the database i get the following message
> 
> Warning: 0 is not a MySQL result index in modules/services/specials.i
> on line 6
> 
> how do i create a variable with a zero value and stop this message
> from comming up in future.

--
Damion Hill
dhill at wantree.com.au



More information about the plug mailing list