| | |
Php Mysql : Code for Multiple Field Search
![]() |
•
•
Join Date: Feb 2008
Posts: 25
Reputation:
Solved Threads: 1
What would be the php mysql code to search more than 1 field in a table ?
Im trying to search for a given partial phone number in all three fields home mobile and work ..
im trying to use
$query = "SELECT `first`, `last`, `home_phone` , `work_phone` , `mobile_phone` FROM `profiles` WHERE LIKE '%516353%'
but this returns everything thats in the table
Any help would be appreciated
Im trying to search for a given partial phone number in all three fields home mobile and work ..
im trying to use
$query = "SELECT `first`, `last`, `home_phone` , `work_phone` , `mobile_phone` FROM `profiles` WHERE LIKE '%516353%'
but this returns everything thats in the table
Any help would be appreciated
php Syntax (Toggle Plain Text)
$query = "select * from table where home_phone like '%516%' OR work_phone like '%516%' OR mobile_phone like '%516%'";
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Feb 2008
Posts: 25
Reputation:
Solved Threads: 1
•
•
•
•
php Syntax (Toggle Plain Text)
$query = "select * from table where home_phone like '%516%' OR work_phone like '%516%' OR mobile_phone like '%516%'";
![]() |
Similar Threads
- Getting Radio Buttons to access Mysql Database (PHP)
- multiple search terms+fulltext search (MySQL)
- Searching multiple fields... (PHP)
- hello and plz help (PHP)
- searching multiple fields (PHP)
Other Threads in the PHP Forum
- Previous Thread: FTP problem
- Next Thread: error_reporting() doesn't seem to work
Views: 4404 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache array box buttons cakephp check checkbox class cms code css curl database date delete directory display download dropdown drupal dynamic echo email error file files form forms function functions header href htaccess html image include insert ip java javascript joomla jquery limit link list login lookup loop mail menu methods mlm mod_rewrite multiple mysql order output parse password paypal php problem query radio random recursion redirect regex remote script search select server session shopping sort sorting source sql string syntax system table unicode update upload url user validate validation variable video web website wordpress xml zend







It should work with OR.. But anyway, cheers!