I don't enter or enter any random info in search, result shows, "No Results Found" And I am okay with that but when I enter anything related to MySQL table shows error,
"**Fatal error: Call to undefined function mysql_fetch_assocc() in /home/opticfhb/public_html/vacationsbychoice.com/search_result.php on line 10".
I know page is able to connect to db.
Form:
<form name="form_search" method="post" action="search_result.php">
<input name="search" id="search" type="text" value="Type the name of City, State or Place you are visiting.." onFocus="if (value == 'Type the name of City, State or Place you are visiting..') {value=''}" onBlur="if (value== '') {value='Type the name of City, State or Place you are visiting..'}" />
<input id="from" type="date" value="Check In" onFocus="if (value == 'Check In') {value=''}" onBlur="if (value== '') {value='Check In'}" />
<input id="to" type="date" value="Check Out" onFocus="if (value == 'Check Out') {value=''}" onBlur="if (value== '') {value='Check Out'}" />
<input name="submit" type="submit" value="Search" />
</form>
PHP:
if(!isset($_POST['search'])) {
header("Location:index.php");
}
$search_sql="SELECT * FROM world_wise WHERE stat_province LIKE '%".$_POST['search']."%' or city LIKE '%".$_POST['search']."%'";
$search_query=mysql_query($search_sql);
if (mysql_num_rows($search_query)!=0) {
$search_rs=mysql_fetch_assocc($search_query);
}
?>
Result:
<h2>Search Result</h2>
<?php if (mysql_num_rows($search_query)!=0) {
do { ?>
<p><?php echo $search_rs['name']; ?></p>
<?php } while ($search_rs=mysql_fetch_assocc($search_query));
} else {
echo "No Results Found";
}
?>