Results 1 to 3 of 3

Thread: PHP question

  1. #1

    PHP question

    Hi everyone,

    I'm hoping that there are a couple of PHP people on here that might be able to help me out. I keep running into some code that I don't see that much but I have no idea what it does. The context for this code is in an SQL statement and the info is passed in from a simple html form.
    Code:
    if ($mode == "name") { 
                    $query_middle = " WHERE lname LIKE '%$criteria%' ";
    What do those % signs do? Like I said before I've seen this a couple of time before but never knew what it did.

    The only thing that I can think of is that its a shortcut way of getting at data that was passed to the file via a previous html form. Is that what that is?

  2. #2
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811

    Re:PHP question

    The keyword here is the LIKE operator, it will return what ever resembles given parameter.

    '%something%' means any text containing anything befor this something and anything after this something
    If you were to use 'something%' then the text would have to start with something there are other delimiters you can use, such as '*' and '?' but I can't remember what they do, I thin k'?'is for single charactor.

  3. #3

    Re:PHP question

    OH OK so its a SQL thing.... That makes sense. I forgot all about that. Thanx for clearing that up.

Similar Threads

  1. PHP Tutorial
    By Waka-Gashira in forum Windows - General Topics
    Replies: 8
    Last Post: 01-27-2005, 08:10 AM
  2. PHP on IIS Server
    By genesis in forum Windows - General Topics
    Replies: 8
    Last Post: 01-03-2005, 11:22 AM
  3. Python and PHP question.
    By Jdun in forum Linux - Software, Applications & Programming
    Replies: 7
    Last Post: 11-26-2004, 01:41 PM
  4. Question about Unix timestamp and PHP
    By Epsilon in forum General Chat
    Replies: 1
    Last Post: 10-20-2004, 11:19 PM
  5. PHP takes ASP as Number 1 SSSL
    By coltrane in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 07-04-2002, 03:47 AM

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
  •