The following query works fine in phpMyAdmin:
SELECT xample.id,
( xample.email != '' ) ,
( xample.bild = '1' ) ,
( xample.url != '' ) ,
COUNT ( DISTINCT xsub.id ) ,
COUNT ( DISTINCT xsub2.id )
FROM xample
LEFT JOIN xsub ON xample.id = xsub.xampleId
LEFT JOIN xsub2 ON xample.id = xsub2.xampleId
GROUP BY xample.id
I wonder why I got an MySQL-Syntax-Error from this PHP-Code:
$sql =<<<EOT
SELECT xample.id,
( xample.email != '' ) ,
( xample.bild = '1' ) ,
( xample.url != '' ) ,
COUNT ( DISTINCT xsub.id ) ,
COUNT ( DISTINCT xsub2.id )
FROM xample
LEFT JOIN xsub ON xample.id = xsub.xampleId
LEFT JOIN xsub2 ON xample.id = xsub2.xampleId
GROUP BY xample.id
EOT;
$res = mysql_query($sql,$lkId);
The queries are absolutely identical ... The same MySQL (3.xx) Server has been used....
Tnx 4 replies
McIheal