I am trying my hardest to write some code to display some data from my database.
The link I use has sends the arguments below through to the display page.
display.php?$location=london
When the page is loaded I get the following error
Warning: Supplied argument is not a valid MySQL result resource in /home/4523/dreams24/www.adultinfo4u.co.uk/public_html/new/display.php on line 15
The code from the page is below...could someone tell me how to write the code correctly to display the information I need.
<?php
include "common.php";
$link = mysql_connect("$server", "$username", "$password")
or die("Could not connect");
mysql_select_db("$db") or die("Could not select database");
if (empty($page)) $page = "";
if (empty($search)) $search = "";
if ($page == search) {
if ($search == 1) {
$result = mysql_query("SELECT * FROM user WHERE location = '$location'");
}
echo "Bad Search";
}
echo "<table align=center><tr><td><font face=arial size=2>Escort</td><td><font face=arial size=2></td><td><font face=arial size=2>City</td><td><font face=arial size=2>Age</td></tr>";
while ($i = mysql_fetch_array($result)) {
echo "<tr><td><font face=arial size=2><a href=view.php?id=".$i[id].">".$i[user]."</a></td><td><font face=arial size=2>".$i[location]."</td><td><font face=arial size=2>".$i[city]."</td><td><font face=arial size=2>".$i[age]."</td></tr>";
}
echo "</table>";
?>