Hi all,
I'm trying to teach myself PHP and MySQL... and I'm stuck.
I've created a table in a dbase and I'm trying to allow a search function through a browser. I've copied some code from other sites and I'm able to return table values using numbers (zip and area codes in this case) but I cannot return a word. Letters seem to throw off the search... i'm sure your nodding your head now.
So, my thought was to use a variable in the code but that's not working either... here's my code:
<?php
$search=$POST['search'];
include ('mylogininfo.php');
$result = mysql_query("SELECT * FROM contacts WHERE city="($POST['search'])";")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>First</th> <th>City</th> </tr>";
while($row = mysql_fetch_array( $result )) {
echo "<tr><td>";
echo $row['first'];
echo "</td><td>";
echo $row['city'];
echo "</td></tr>";
}
echo "</table>";
?>
Any help is greatly appreciated... i've spent 2 days trying to figure it out, look it up and try different variations without luck.