• 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
    $location = $_POST['location'];
    $city = mysql_query("SELECT
    city FROM wp_locations WHERE city = $location");
    if (!$city){
    mysql_query("INSERT INTO wp_locations
    (id, city) VALUES('', '$location' ) ");
    echo ('Adding Location'); }
    ?>

Viewing 1 replies (of 1 total)
  • Thread Starter clay

    (@clay)

    OK, I have that part working.
    I’ve written 3 functions
    1 which takes the value of a text box, checks if it exists in the table, and adds it if it doesn’t.
    The other 2 display the values in a select drop down or a list.
    Now I can’t figure out where to go from here.

Viewing 1 replies (of 1 total)
  • The topic ‘PHP/Mysql: Testing if input exists in table’ is closed to new replies.