RE: [PHP] Function Problem (Long-ish)

From: Date: Tue, 13 Jan 2004 12:57:35 +0000
Subject: RE: [PHP] Function Problem (Long-ish)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-174431@lists.php.net to get a copy of this message
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:rich@launchcode.co.uk] Sent: 13 January 2004 12:48 To: Dave Carrera Cc: php-general@lists.php.net 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:rich@launchcode.co.uk --- 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

« previous php.general (#174431) next »