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
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to search a column in MySQL (return boolean)

    trying to search a column in MySQL and returning a boolean result. How do I do this?

    Like say search for $string=mice in column='food' of table 'dog'.

  • #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
    You won't get a boolean result back, but you can "force" a boolean result by checking the number of rows your query returns and if it's > 0 then return "true".

    Or are you asking what the syntax is for the query?

    http://dev.mysql.com/doc/refman/4.1/en/select.html

  • #3
    New Coder
    Join Date
    Aug 2006
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks I got it. You're right. Just check the result and execute based on the mysql_num_rows command.


  •  

    Posting Permissions

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