Connecting Tech Pros Worldwide Help | Site Map

Multiple WHERE statements and numrows()

Abersparky
Guest
 
Posts: n/a
#1: Feb 27 '07
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";

Jeff North
Guest
 
Posts: n/a
#2: Feb 27 '07

re: Multiple WHERE statements and numrows()


On 26 Feb 2007 21:31:38 -0800, in comp.lang.php "Abersparky"
<abersparky@gmail.com>
<1172554298.603800.62920@k78g2000cwa.googlegroups. comwrote:
Quote:
>| 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
Quote:
>| $comquery_data = mysql_fetch_row($comquery );
>| $comnumrows = $comquery_data[0];
>| print $comnumrows . " comments";
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Toby A Inkster
Guest
 
Posts: n/a
#3: Feb 27 '07

re: Multiple WHERE statements and numrows()


Jeff North wrote:
Quote:
jnorthau@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!
Jeff North
Guest
 
Posts: n/a
#4: Feb 27 '07

re: Multiple WHERE statements and numrows()


On Tue, 27 Feb 2007 09:58:47 +0000, in comp.lang.php Toby A Inkster
<usenet200702@tobyinkster.co.uk>
<nvbdb4-ud1.ln1@ophelia.g5n.co.ukwrote:
Quote:
>| Jeff North wrote:
>|
>| jnorthau@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.....
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Closed Thread


Similar PHP bytes