Jump to content

miscreant

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

miscreant's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Got it Thank you all so much. I also had to add this to the sql query.. DESC <?php $con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("spotid", $con); $query = "SELECT spot_id FROM spot_num ORDER BY spot_id DESC LIMIT 0,1"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) $plus = $row[spot_id] +1; $sql="INSERT INTO spot_num (name_id, spot_id) VALUES ('$_POST[name_id]','$plus')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo $_POST[name_id],$plus; mysql_close($con) ?>
  2. Ok I have tried this it is not incrementing but it is posting the single Value of 1 in spot_id while ($row = mysql_fetch_array($result)) $row[spot_id] = $plus++; $sql="INSERT INTO spot_num (name_id, spot_id) VALUES ('$_POST[name_id]','$plus')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo $_POST[name_id],$plus; mysql_close($con) ?>
  3. I am really new at this where would I need to put that?
  4. <?php $con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("spotid", $con); $query = "SELECT spot_id FROM spot_num ORDER BY spot_id LIMIT 0,1"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $row[spot_id]+1; } $sql="INSERT INTO spot_num (name_id, spot_id) VALUES ('$_POST[name_id]','$_POST[$row]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo $_POST[name_id],$_POST[$row]; mysql_close($con) ?> This works up to here "$row[spot_id]+1" everything below that works with the exception "$_POST[$row]" I want to pass the "$row[spot_id]+1" to "$_POST[$row]" So when someone fills out the form page it will then pass along what they enter on the form page on submit, it will then query the DB for the [spot_id] then increment by 1 then write both the incremented value and the users form information back to the DB. Help Thank you
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.