cleanvar()
Account Closed
- Impact
- 0
Hi all,
I am using the script below and i keep getting Warning:
mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/awakened/public_html/search/search.php on line 19
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/awakened/public_html/search/search.php on line 24
and the titles display if there is no result, but i only want them to display when there are some and it says if there isnt any, but its not working, could someone please correct the code?
Will
I am using the script below and i keep getting Warning:
mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/awakened/public_html/search/search.php on line 19
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/awakened/public_html/search/search.php on line 24
and the titles display if there is no result, but i only want them to display when there are some and it says if there isnt any, but its not working, could someone please correct the code?
Will
PHP:
<?php
//include('connect.php');
if (isset($_POST['submit']))
{
$hostt = $_POST['hostt'];
$hc = $_POST['hc'];
$lang = $_POST['land'];
$mds = $_POST['mds'];
$mbw = $_POST['mbw'];
$sl = $_POST['sl'];
$ads = $_POST['ads'];
echo "You chose: <b>Type:</b> $hostt, <b>Cost:</b> $hc, <b>Min Diskspace:</b> $mds, <b>Min B/W:</b> $mbw, <b>Server Location:</b> $sl, <b>Ads:</b> $ads.";
$query = "SELECT * FROM hosts WHERE type = '$hostt' AND cost = '$hc' AND language = '$lang' AND mindisk <= '$mds' AND minbw <= '$minbw' AND serverlocation = '$sl' AND ads = '$ads'";
//$result = mysql_query($query) or die (mysql_error());
$cr = mysql_num_rows($result);
if ($cr == 0)
{
echo "No results found, Sorry.";
}
while ( $row = mysql_fetch_array($result));
{
$name = $row['name'];
$url = $row['url'];
$type = $row['type'];
$cost = $row['cost'];
$language = $row['language'];
$mindisk = $row['mindisk'];
$minbw = $row['minbw'];
$serverlocation = $row['serverlocation'];
$ads = $row['ads'];
// Now echo results
echo "Company matches which meet your criteria";
echo "<a href=\"$url\"><b>$name</b></a><br>
<b>Type:</b>$type<br>
<b>Cost:</b>$cost<br>
<b>Language:</b> $language<br>
<b>Minimum Disk Space:</b> $mindisk<br>
<b>Minimum Bandwith:</b> $minbw<br>
<b>Server Location:</b> $serverlocation<br>
<b>Ads:</b> $ads<br><br>
";
}
}
?>
<form name="search" method="post">
Type of Host: <select name="hostt">
<option>Shared</option>
<option>Reseller</option>
<option>Shoutcast</option>
<option>Dedicated</option>
<option>VPS</option>
<option>File</option>
<option>Image</option>
<option>Video</option>s
<option>Game</option>
<option>Other</option>
</select>ย
Hosting Cost: <select name="hc"><option>Free</option> <option>Paid</option> <option>Paid to Post</option> <option>Ads</option></select>
Language: <select name="lang"><option>English</option> <option>Chineese</option> <option>German</option> <option>French</option> <option>Other</option></select>
Minimum Diskspace: <select name="mds"><option>0mb</option><option>50mb</option> <option>100mb</option> <option>500mb</option> <option>1000mb</option></select><br>
Minimum Bandwith: <select name="mbw"><option>0gb</option><option>1gb</option> <option>5gb</option> <option>10gb</option> <option>20gb</option></select>
Server Location: <select name="sl"><option>All</option> <option>UK</option> <option>USA</option> <option>Germany</option, <option>Other</option></select>
Ads: <select name="ads"><option>No</option><option>Yes</option></select>
<br><input type="submit" name="submit" value="Search">
</form>







