A simple question that has created me many problems:
If I have "New-Jersey Nets" for example how can I make the query select this field only if it is entered(or compared with ) "New" or "Jersey" or "Nets".I have seen some similar solutions but one worked.
simple question,hard solution
Moderator: General Moderators
Code: Select all
SELECT * FROM database WHERE field LIKE '%$search%'im sure there will be an easier way then what im saying below because its very impractical
have you ever seen something more impractical 
not sure if itll work, just made it up.
Code: Select all
$result = mysql_query("SELECT * FROM database");
$row = mysql_fetch_array($result);
foreach($row as $var) {
$split = preg_split('/(" "|-|_)/', $var); // i dont know how to write regular expressions (supposed to split at space, underscore and dash)
$num = count($split);
for($i=0; $i < $num; $i++) {
if($search == $split[$i]) {
echo $var . ' match found\n';
continue;
}
}
}not sure if itll work, just made it up.