Results 1 to 1 of 1

Thread: SQL - Like *SOLVED*

Threaded View

  1. #1

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    SQL - Like *SOLVED*

    I've got a search feature to search for all User Names simialr to what is entered as the search criteria.

    I have two users (Joe, John) and when I enter 'Jo' as the search criteria I would expect both Joe and John to be found but I don't get any results. I think my SQL statement is correct but even if I put in John or Joe I still get no results?? Could someone have a look for me.

    Thanks.

    PHP Code:
    //This is my query
    $query "SELECT * FROM user_details WHERE user_name LIKE '$username*'";
    $result mysql_query($query);

    //Check for matches
    if (mysql_num_rows($result) == 0) {

    echo 
    "There were no users found with the user name entered";
    exit;

    EDIT: I substituted * for % and everything works fine
    Last edited by lintz; Aug 31st, 2004 at 09:23 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
  •  



Click Here to Expand Forum to Full Width