Thanks for the reply Richard. If I use this sql in my func:
$sql = mysql_query("select count(fieldtocount) as cnt, sum(fieldforsum) as total from $tab3 where fieldtocompare =\"$varcomparedwith\""); Then all is fine and works as expected. If I then add: $sql = mysql_query("select fieldtoselect, count(fieldtocount) as cnt, sum(fieldforsum) as total from $tab3 where fieldtocompare =\"$varcomparedwith\""); So adding the extra field to select, This dose not work :-( Although in other apps not sql-ing within a func this kind of sql query works. So I am puzzled why and if you or the list can help I would appreciate it. Thank you Dave C -----Original Message----- From: Richard Davey [mailto:[EMAIL PROTECTED] Sent: 13 January 2004 12:48 To: Dave Carrera Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Function Problem (Long-ish) Hello Dave, Tuesday, January 13, 2004, 12:34:33 PM, you wrote: DC> sql = mysql_query("select *, count(id) as cnt from table where DC> somefield=\"somevar\""){ It's nothing to do with your function, simply that your SQL is invalid. -- Best regards, Richard mailto:[EMAIL PROTECTED] --- Incoming 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 --- 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