Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder sitNsmile's Avatar
    Join Date
    Dec 2009
    Location
    Charlotte, NC
    Posts
    358
    Thanks
    19
    Thanked 2 Times in 2 Posts

    query using "LIKE" not reading

    Trying to see why this isn't reading properly. It's probably something simple, usually always is. But here

    changed wordgames to static to show you and test. In categories there is "Car Games" but I want it to look for the word "Car" and give me the catid.
    PHP Code:

    $wordgames 
    "Car";
    $check_cat mysql_query("SELECT * FROM categories WHERE (catname = LIKE \"%$wordgames%\")");
    while(
    $row mysql_fetch_array($check_cat)) { 
    $catid $row['catid'];
    }
    echo 
    $catid."!!!"
    anyone see what I am missing?

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    SELECT * FROM table WHERE column_name LIKE '%Car%'

    No equal sign.

  • Users who have thanked Fumigator for this post:

    sitNsmile (03-25-2010)

  • #3
    Regular Coder sitNsmile's Avatar
    Join Date
    Dec 2009
    Location
    Charlotte, NC
    Posts
    358
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Fumigator View Post
    SELECT * FROM table WHERE column_name LIKE '%Car%'

    No equal sign.

    Awesome it does work. Always those little things that matter. Thanks
    Last edited by sitNsmile; 03-25-2010 at 07:56 PM.


  •  

    Posting Permissions

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