|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
I have a database in mysql
and i use php to access it "LIKE %KeyWord%" whitch is fine but i to enter the KeyWord in a Box on a webpage ether one or more words |
|
#2
|
|||
|
|||
|
Try this...
You can try this:
// the name of field on the form must be keywords, or you // can change the code to fit the name at your form $keywords = split(" ",$keywords); $sql = "SELECT * FROM table WHERE"; for($i = 0; $i < sizeof($keywords); $i++) { if($i == 0) { $sql_tmp = " field_name LIKE '%" . $keywords[$i] . "%'"; } else { $sql_tmp = " AND field_name LIKE '%" . $keywords[$i] . "'"; } $sql .= $sql_tmp; } $sql .= " ORDER BY field_name"; Hope this helps...
__________________
Regards, Ramiro Varandas Jr. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > input box php |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|