Hello guys,I'm trying to search the database with the follwing code but every time it returns Records not found no matter whether if I enter the capital letter or small letter in the search fill in the HTML form I had created.
<?php
//SearchRecord($question,$answer,$Category);
//function SearchRecord($question,$answer,$Category){
include("password.php");
mysql_connect (localhost, $User, $Password);
mysql_select_db ($DBName);
if ($question == ""){
$question = '%';
}
if ($answer == ""){
$answer = '%';
}
$Table = $Category;
$result = mysql_query ("SELECT * FROM $Table WHERE question LIKE '$question%'AND answer LIKE '$answer%'");
if ($row = mysql_fetch_array($result)) {
do {
print $row["question"];
print (" ");
print $row["answer"];
print ("<p>");
} while($row = mysql_fetch_array($result));
} else {
print "Sorry, no records were found!";
}
?>