Empty results with Where Clause

Agreepall

New Member
I have problem with showing results from "visits" table depending on search form !here is the code !\[code\] <?php $date1 = $_POST['day'] . "-" . $_POST['month'] . "-" . $_POST['year']; $date2 = $_POST['day1'] . "-" . $_POST['month1'] . "-" . $_POST['year1']; $product=$_POST['product']; $region=$_POST['region']; $speciality=$_POST['speciality']; $type=$_POST['visit_type'];$query="SELECT id, name, seller_1_name, seller_2_name FROM visits Where (speciality ='$speciality') AND (type ='$type') AND (product ='$product') AND (date BETWEEN '$date1' AND '$date2')";$num=mysql_numrows($result);$row = mysql_fetch_array($result);?><h3> Showing results where Product is <?php echo $product; ?>, Speciality is <?php echo $speciality ?>, Region is <?php echo $region ?> and Type is <?php echo $type ?>.</h3> <table class="auto-style4" style="width: 100%" border="1"><tr> <td style="height: 18px">ID</td> <td style="height: 18px">Name</td> <td style="height: 18px">seller one name</td> <td style="height: 18px">seller 2 name</td> </tr> <tr> <?php$i=0;while ($i < $num) {$f1=mysql_result($result,$i,"id");$f2=mysql_result($result,$i,"name");$f4=mysql_result($result,$i,"seller_1_name");$f5=mysql_result($result,$i,"seller_2_name");?> <td><?php echo $f1; ?> </td> <td><?php echo $f2; ?> </td> <td><?php echo $f4; ?></td> <td><?php echo $f5; ?></td> </tr><?php$i++;}?> \[/code\]it shows the heading with the correct variables entered but the table is empty with error code : Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/ebarea/public_html/.../.../results_submitt.php on line 175Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ebarea/public_html/.../.../results_submitt.php on line 176What's WRONG >!
 
Back
Top