I think this a lesson to me and anyone else to make more use of
mysql_error() in sql statements.

I soon as I saw the Engishized explanation via mysql_error() it was obvious
and easy to fix.

Note to self: Use mysql_error() as standard ;-)

I humbly thank you all for you help.

Dave C


-----Original Message-----
From: Vincent Jansen [mailto:[EMAIL PROTECTED] 
Sent: 13 January 2004 13:05
To: 'Dave Carrera'; 'Richard Davey'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Function Problem (Long-ish)


I doubt that...

MySQL says:

Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is
illegal if there is no GROUP BY clause

---
Vincent Jansen

-----Original Message-----
From: Dave Carrera [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 13 januari 2004 13:58
To: 'Richard Davey'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Function Problem (Long-ish)


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






---
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

Reply via email to