By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,967 Members | 1,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,967 IT Pros & Developers. It's quick & easy.

Multiple WHERE statements and numrows()

P: n/a
Can anyone help me out here...

I can't quite seem to get this right. I have a table of which I need
to extract data based on two fields: entry_id and vis. The below
results in error. When I remove the second condition from the WHERE
statement, it counts the entry id as "comnumrows".

Is my SELECT statement wrong???

$comvis = "N";
$comquery = mysql_query("SELECT * FROM comments WHERE (entry_id =
$id AND vis = $comvis)");
$comquery_data = mysql_fetch_row($comquery );
$comnumrows = $comquery_data[0];
print $comnumrows . " comments";

Feb 27 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 26 Feb 2007 21:31:38 -0800, in comp.lang.php "Abersparky"
<ab********@gmail.com>
<11*********************@k78g2000cwa.googlegroups. comwrote:
>| Can anyone help me out here...
|
| I can't quite seem to get this right. I have a table of which I need
| to extract data based on two fields: entry_id and vis. The below
| results in error. When I remove the second condition from the WHERE
| statement, it counts the entry id as "comnumrows".
|
| Is my SELECT statement wrong???
|
| $comvis = "N";
| $comquery = mysql_query("SELECT * FROM comments WHERE (entry_id =
| $id AND vis = $comvis)");
vis = '$comvis')");
because the variable is a string/char
>| $comquery_data = mysql_fetch_row($comquery );
| $comnumrows = $comquery_data[0];
| print $comnumrows . " comments";
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Feb 27 '07 #2

P: n/a
Jeff North wrote:
jn******@yourpantsyahoo.com.au : Remove your pants to reply
Trousers down; would you prefer the photos in PNG or JPEG?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Feb 27 '07 #3

P: n/a
On Tue, 27 Feb 2007 09:58:47 +0000, in comp.lang.php Toby A Inkster
<us**********@tobyinkster.co.uk>
<nv************@ophelia.g5n.co.ukwrote:
>| Jeff North wrote:
|
| jn******@yourpantsyahoo.com.au : Remove your pants to reply
|
| Trousers down; would you prefer the photos in PNG or JPEG?
Production quality video will suffice :-P

Oh BTW, I saw someone else with this type of sig and I asked if I
could 'borrow it'.

Now getting back to the topic at hand.....
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Feb 27 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.