Multiple WHERE statements and numrows()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Abersparky

    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("SE LECT * FROM comments WHERE (entry_id =
    $id AND vis = $comvis)");
    $comquery_data = mysql_fetch_row ($comquery );
    $comnumrows = $comquery_data[0];
    print $comnumrows . " comments";

  • Jeff North

    #2
    Re: Multiple WHERE statements and numrows()

    On 26 Feb 2007 21:31:38 -0800, in comp.lang.php "Abersparky "
    <abersparky@gma il.com>
    <1172554298.603 800.62920@k78g2 000cwa.googlegr oups.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("SE LECT * 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";
    ---------------------------------------------------------------
    jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
    ---------------------------------------------------------------

    Comment

    • Toby A Inkster

      #3
      Re: Multiple WHERE statements and numrows()

      Jeff North wrote:
      jnorthau@yourpa ntsyahoo.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!

      Comment

      • Jeff North

        #4
        Re: Multiple WHERE statements and numrows()

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

        Comment

        Working...