eman619 Posted October 7, 2012 Share Posted October 7, 2012 (edited) I’m very new to php, and I’m making a simple web application for a car show registration form. Basically, a person fills out a form with name / vehicle info, and when you click submit, it displays the info and asks the user if he/she wants to modify or submit. When someone clicks submit, I want to assign a unique, incremental “entry number” to each car show competitor. So if I have somewhere the starting entry number of #1000, I would like the next person that submits the form to be assigned entry number 1001. MySQL Table has only 1 table, called ‘competitors’, which has firstname, lastname, vehicle info, etc.etc.etc., and it has the last field called ‘entrynumber’. I passed the variables from page to page via Session variables (not sure if this is right on what I did) My questions are: 1. How would I get the next ‘entry number’ before writing all the data? Do I make a separate table that has a starting entry number, and each time someone fills out a form, it increments this table, or something to that effect? 2. What if there were 5 computers on a table, and 5 car competitors filled out the web form at the same time. What can I do to address the issue of locking the next entry number, since several people may try to write to the database, and may be trying to use the next incremental entry number? This is the page on my server: http://explosivetile...egistration.php my code: new_registration.php page: [color=#000000][font=Arial][size=4][background=transparent]<?php[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]session_start(); // start up your PHP session![/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]ini_set('session.cache_limiter', 'private');[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]header('Cache-Control: private');[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]include('includes/dbconnect.php');[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]?>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd%22>"]http://www.w3.org/TR...nsitional.dtd">[/url][/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<html xmlns="[url="http://www.w3.org/1999/xhtml%22>"]http://www.w3.org/1999/xhtml">[/url][/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<head>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<title>Untitled Document</title>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<link href="css/main.css" rel="stylesheet" type="text/css" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</head>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<body>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<div id="maincontain">[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p>Car Registration</p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p> </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<form id="form1" name="form1" method="post" action="new_registration_display.php">[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="firstname"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] First Name:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="firstname" id="firstname" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] Last Name:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="lastname"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="lastname" id="lastname" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Street Address:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="streetaddress"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input name="streetaddress" type="text" id="streetaddress" size="45" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>City:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="city"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="city" id="city" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] State:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="state"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input name="state" type="text" id="state" size="5" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="zipcode"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] Zip Code:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="zipcode" id="zipcode" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Home Phone:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="homephone"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="homephone" id="homephone" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] Mobile Phone:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="mobilephone"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="mobilephone" id="mobilephone" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Email:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="email"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="email" id="email" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <hr />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Vehicle Make:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="vehiclemake"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="vehiclemake" id="vehiclemake" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] Vehicle Model:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="vehiclemodel"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="vehiclemodel" id="vehiclemodel" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Vehicle Year:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="vehicleyear"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="vehicleyear" id="vehicleyear" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Car Club:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="carclub"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input name="carclub" type="text" id="carclub" size="35" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Comments / Modifications:</p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="comments"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <textarea name="comments" cols="45" id="comments"></textarea>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="submit" name="submit" id="submit" value="Submit" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="reset" name="reset" id="reset" value="Reset" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p> </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</form>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p> </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</div>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</body>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</html>[/background][/size][/font][/color] UPDATE PAGE update_registration.php [color=#000000][font=Arial][size=4][background=transparent]<?php[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]session_start(); // start up your PHP session![/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]ini_set('session.cache_limiter', 'private');[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]header('Cache-Control: private');[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]include('includes/dbconnect.php');[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]?>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd%22>"]http://www.w3.org/TR...nsitional.dtd">[/url][/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<html xmlns="[url="http://www.w3.org/1999/xhtml%22>"]http://www.w3.org/1999/xhtml">[/url][/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<head>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<title>Untitled Document</title>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<link href="css/main.css" rel="stylesheet" type="text/css" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</head>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<body>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<div id="maincontain">[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p>Car Registration</p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p> </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<form id="form1" name="form1" method="post" action="new_registration_display.php">[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="firstname"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] First Name:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="firstname" id="firstname" value="<?php echo $_SESSION['v_firstname']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] Last Name:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="lastname"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="lastname" id="lastname" value="<?php echo $_SESSION['v_lastname']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Street Address:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="streetaddress"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input name="streetaddress" type="text" id="streetaddress" size="45" value="<?php echo $_SESSION['v_address']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>City:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="city"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="city" id="city" value="<?php echo $_SESSION['v_city']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] State:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="state"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input name="state" type="text" id="state" size="5" value="<?php echo $_SESSION['v_state']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="zipcode"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] Zip Code:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="zipcode" id="zipcode" value="<?php echo $_SESSION['v_zip']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Home Phone:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="homephone"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="homephone" id="homephone" value="<?php echo $_SESSION['v_homephone']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] Mobile Phone:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="mobilephone"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="mobilephone" id="mobilephone" value="<?php echo $_SESSION['v_mobilephone']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Email:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="email"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="email" id="email" value="<?php echo $_SESSION['v_email']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <hr />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Vehicle Make:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="vehiclemake"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="vehiclemake" id="vehiclemake" value="<?php echo $_SESSION['v_vehiclemake']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] Vehicle Model:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="vehiclemodel"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="vehiclemodel" id="vehiclemodel" value="<?php echo $_SESSION['v_vehiclemodel']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Vehicle Year:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="vehicleyear"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="text" name="vehicleyear" id="vehicleyear" value="<?php echo $_SESSION['v_vehicleyear']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Car Club:[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="carclub"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input name="carclub" type="text" id="carclub" size="35" value="<?php echo $_SESSION['v_carclub']; ?>" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Comments / Modifications:</p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <label for="comments"></label>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <textarea name="comments" id="comments" cols="45" rows="5"><?php echo $_SESSION['v_comments']; ?></textarea>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="submit" name="submit" id="submit" value="Submit" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <input type="reset" name="reset" id="reset" value="Reset" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p> </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</form>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p> </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</div>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</body>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</html>[/background][/size][/font][/color] NEW REGISTRATION DISPLAY PAGE new_registration_display.php *THIS is where I need help ** [color=#000000][font=Arial][size=4][background=transparent]<?php[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]session_start(); // start up your PHP session![/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]ini_set('session.cache_limiter', 'private');[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]header('Cache-Control: private');[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]include('includes/dbconnect.php');[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$v_firstname = $_POST['firstname'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$v_lastname = $_POST['lastname'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$v_address = $_POST['streetaddress'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$v_city = $_POST['city'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$v_state = $_POST['state'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$v_zip = $_POST['zipcode'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$v_vehiclemake = $_POST['vehiclemake'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$v_vehiclemodel = $_POST['vehiclemodel'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$v_vehicleyear = $_POST['vehicleyear'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$v_carclub = $_POST['carclub'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$v_comments = $_POST['comments'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_firstname'] = $_POST['firstname'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_lastname'] = $_POST['lastname'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_address'] = $_POST['streetaddress'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_city'] = $_POST['city'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_state'] = $_POST['state'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_zip'] = $_POST['zipcode'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_homephone'] = $_POST['homephone'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_mobilephone'] = $_POST['mobilephone'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_email'] = $_POST['email'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_vehiclemake'] = $_POST['vehiclemake'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_vehiclemodel'] = $_POST['vehiclemodel'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_vehicleyear'] = $_POST['vehicleyear'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_carclub'] = $_POST['carclub'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]$_SESSION['v_comments'] = $_POST['comments'];[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]?>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd%22>"]http://www.w3.org/TR...nsitional.dtd">[/url][/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<html xmlns="[url="http://www.w3.org/1999/xhtml%22>"]http://www.w3.org/1999/xhtml">[/url][/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<head>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<title>Untitled Document</title>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<link href="css/main.css" rel="stylesheet" type="text/css" />[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</head>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<body>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<div id="maincontain">[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p>Car Registration</p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p> </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p>First Name: <?php echo $v_firstname; ?></p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p>Last Name: <?php echo $v_lastname; ?></p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>City: <?php echo $v_address; ?></p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p>State: <?php echo $v_state; ?></p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p>Zip: <?php echo $v_zip; ?></p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p>City: <?php echo $v_city; ?></p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p> </p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Vehicle Make: <?php echo $v_vehiclemake; ?></p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p>Vehicle Model: <?php echo $v_vehiclemodel; ?></p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p>Vehicle Year: <?php echo $v_vehicleyear; ?></p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p>Car Club: <?php echo $v_carclub; ?></p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent] <p>Comments: <?php echo $v_comments; ?></p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]<p><a href="update_registration.php">Click to update</a> | Click to Submit and Complete</p>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</div>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</body>[/background][/size][/font][/color] [color=#000000][font=Arial][size=4][background=transparent]</html>[/background][/size][/font][/color] *** On the “Click to Submit and Complete” above, when someone clicks this, I want it to write to mysql, but with the next incremental record for the entrynumber field in the database. How would I find the previous row’s entrylevel and increment? Any help is appreciated Edited October 7, 2012 by PFMaBiSmAd code in code tags please Quote Link to comment Share on other sites More sharing options...
Jessica Posted October 7, 2012 Share Posted October 7, 2012 The table should have an id column set to autoincrement. Quote Link to comment Share on other sites More sharing options...
eman619 Posted October 7, 2012 Author Share Posted October 7, 2012 Yes, it does for the main id / primary key. But if each row (or competitor) has an 'entry number' (when they show up with his/her car, we want to put a sticker with the competitor entry number), I think I have an idea of finding it and now incrementing it, but what if several people clicked submit at the same time? Quote Link to comment Share on other sites More sharing options...
Jessica Posted October 7, 2012 Share Posted October 7, 2012 Why do you want two fields with unique incrementing ids in the same table? Just use one of them.... Quote Link to comment Share on other sites More sharing options...
Barand Posted October 7, 2012 Share Posted October 7, 2012 I don't know your db structure but I would have something like car table --> car_id (PK), owner, make, etc (I think you have this) show table --> show_id (PK), show_date, show_place etc entrant table show_id, entry_number (auto_inc) car_id, primary key (show_id, entry_number) Since the entry number is auto_inc and is the second part of the primary key it will recommence from 1 for each new show. And because it is auto_incrementing you don't have to worry about duplication as different sessions are isolated. Quote Link to comment Share on other sites More sharing options...
eman619 Posted October 7, 2012 Author Share Posted October 7, 2012 I will try that, Thanks Barand! Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 7, 2012 Share Posted October 7, 2012 (edited) I edited your first post in this thread to add the forum's code tags and the forum software trashed your code by displaying all the underlying wysiwyg bbcode tags as being code. If any of your code is needed for reference with future questions in this thread, please repost the relevant part of your code. Edited October 7, 2012 by PFMaBiSmAd Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.