Re: Program works only when there are records :-(
| From: | Ryan A | Date: | Sun, 14 Sep 2003 23:38:17 +0000 |
| Subject: | Re: Program works only when there are records :-( | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162584@lists.php.net to get a copy of this message | ||
Hey,
Thanks for replying.
> This looks like a pretty decent query to me...
Thanks.
I took your advise and put a couple of "print mysql_error();" and got 8 of
the same error...
*************
You have an error in your SQL syntax near 'UNION SELECT COUNT(*), 'Count2'
FROM dedicated where user='testing' and' at line 1
************
But i have checked the SQL over and again....anybody see something wrong?
>Ow, and one question: does it give the errors if
> there's no rows in any table, or also if there's no rows in one of the
> tables? And in the second option, does it give you the errors less often?
Just ran a couple of tests, its giving the same output even if the table has
records!
Cant understand it.
Been working 9 straight hours today and i think i screwed up somewhere with
this code with all the modifications i have been doing.
Tell me if you spot anything, am posting the sql again below.
Cheers,
-Ryan
$tt = "SELECT COUNT(*), 'Count1' FROM shared WHERE user
='".$mmmy_user."'
and ccno=".$mmmy_ccno."
UNION
SELECT COUNT(*), 'Count2' FROM dedicated
WHERE user='".$mmmy_user."' and ccno=".$mmmy_ccno."
UNION
SELECT COUNT(*),
'Count3' FROM reseller WHERE user ='".$mmmy_user."' and
ccno=".$mmmy_ccno."
UNION
SELECT COUNT(*), 'Count4' FROM colocated WHERE user ='".$mmmy_user."'
and ccno=".$mmmy_ccno."
UNION
SELECT COUNT(*), 'Count5' FROM freehosting
WHERE user ='".$mmmy_user."' and ccno=".$mmmy_ccno;