Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old February 27th, 2007, 05:45 AM
Abersparky
Guest
 
Posts: n/a
Default Multiple WHERE statements and numrows()

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

  #2  
Old February 27th, 2007, 07:05 AM
Jeff North
Guest
 
Posts: n/a
Default 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
---------------------------------------------------------------
  #3  
Old February 27th, 2007, 10:15 AM
Toby A Inkster
Guest
 
Posts: n/a
Default 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!
  #4  
Old February 27th, 2007, 11:35 AM
Jeff North
Guest
 
Posts: n/a
Default 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
---------------------------------------------------------------
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles