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.
    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
    redhead's Avatar
    Join Date
    Jun 2001
    Copenhagen, Denmark

    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. Fan Question
    By Millermagic in forum Windows - General Topics
    Replies: 29
    Last Post: 02-04-2005, 06:00 AM
  2. 1 of my many question to come
    By gentoo in forum Linux - General Topics
    Replies: 1
    Last Post: 11-07-2004, 07:37 PM
  3. Web Question
    By GhostDawg in forum Linux - Hardware, Networking & Security
    Replies: 5
    Last Post: 02-08-2004, 08:16 AM
  4. cga - another question
    By LiNuts in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 10-22-2002, 12:20 PM
  5. a log question
    By ericn in forum Linux - General Topics
    Replies: 4
    Last Post: 12-20-2001, 04:57 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