Hi List, I have a self-made function that uses a MySql statement something like this:
Function MyFunc(){ sql = mysql_query("select * from table where somefield=\"somevar\""){ while(blah blah){ $var ="blah blah"; } } return $blah; } This works ok but if I add a bit to the sql then I get a Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in error, so if I add: Function MyFunc(){ sql = mysql_query("select *, count(id) as cnt from table where somefield=\"somevar\""){ while(blah blah){ $var ="blah blah"; } } return $blah; } I get the error. But this works: Function MyFunc(){ sql = mysql_query("select count(id) as cnt, sum(numfield) as total from table where somefield=\"somevar\""){ while(blah blah){ $var ="blah blah"; } } return $blah; } My Question is Why ? Any help is a appreciated and I thank you fully in advance. Dave C --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php