Hi!
Can someone help me? I've created this code to search a text field in my SQL database. It works as is but I want it to search two fields ($text and $title), instead of just $text. Can anyone help?
Thanks n advance.
<?
include ("dbConfig.php");
if ($title == "")
{$title = 'Nothing!';}
if ($text == "")
{$text = 'nothing';}
$result = mysql_query ("SELECT * FROM solutions WHERE text LIKE '%$text%'");
if ($row = mysql_fetch_array($result)) {
PRINT "<font face=tahoma size=2>Your search for <b>$text</b> returned the following results:<br><br>";
do {
$record_text = $row[3];
$text_limit = substr($record_text, 0, 300);
PRINT "<font face=tahoma size=2><b>";
print "<a href=\"solution.php?id=$row[id]\">$row[title]</a>";
print ("</b> ");
print ("<br>");
print $text_limit;
print ("...<p>");
} while($row = mysql_fetch_array($result));
} else {
PRINT "<font face=tahoma size=2>Your search for <b>$text</b> returned 0 results:<br><br>";
}
$sql = "INSERT INTO search (text) VALUES ('$text')";
$result = mysql_query($sql);
?>