SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: WHERE statement

  1. #1
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    WHERE statement

    Hello, I am writing a query statement and for some reason I am just not figuring out the where statement. I have the following code but I get an error:
    PHP Code:
    28 $result mysql_query("SELECT count(*) AS count FROM click_sales WHERE ref='$id' AND order='".$qry['name']."'" );

    29 $row=mysql_fetch_array($result); 

    30 $count3$row['count']; 
    The error is:
    Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\xxxxxxx on line 29


    Any suggestions?

    It works when I just have ti ref='$id'.
    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "order" is a bad name on a column because it's a reserved word in mysql?
    Try ...AND `order`=...

  3. #3
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thanks I renamed my field and it works great now. Thanks everybody
    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •