PHP/Mysql: Testing if input exists in table
-
I hate that I can never find any moderate level tutorials. It’s either always way too basic, or far too advanced. I have been trying to get this to work for hours now.. something really simple. I am trying to take the input from a text box, test to see if it is in the table already, and if not add it.
<?php
city
$location = $_POST['location'];
$city = mysql_query("SELECTFROM
wp_locationsWHERE
city=
$location");
if (!$city){
mysql_query("INSERT INTO wp_locations
(id, city) VALUES('', '$location' ) ");
echo ('Adding Location'); }
?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP/Mysql: Testing if input exists in table’ is closed to new replies.