In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > 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.
Bit hard without seeing your actual code; however if you were to use mysql_error() after your call to the database it would probably return you a useful error message. Cheers -- Quod subigo farinam A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php