RE: [PHP-DB] Multiply Auto_Increments
Hi Richard, Thank you for all your time. It is nearly midnight here! All the code including // test sections is News Article added"; } // echo ($msg); $close = mysql_close($connection) or die("Could not close database"); if ($close) {echo ("Database closed");}; ?> Toby Parkins -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Multiply Auto_Increments
Looking at the code you've pasted in below, I don't see anything that would result in one valid row plus additional blank rows. Is the code you supplied in a script with any control structures like IF, WHILE, or FOR? Is it included into a script in the middle of a control structure? If you answered yes to any of the above questions, is it supposed to be? Have you closed those control structures prior to executing the INSERT? If there is more code in the script, can you please paste it all? It's possitble something else higher up in the script is causing the problem. Sorry I wasn't more specific the first time. Rich > -Original Message- > From: Toby Parkins [mailto:toby@;uknetweb.com] > Sent: Wednesday, November 13, 2002 2:16 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP-DB] Multiply Auto_Increments > > > Richard, > > Here is the code > > $sql = " > INSERT INTO $table > (id,date,user,title,brief,body,expires,visible) > > VALUES(NULL,\"$date\",\"$user\",\"$title\",\"$brief\",\"$body\ > ",\"$exdate\", > \"1\") > "; > > $connection = mysql_connect($dbhost, $dbusername, > $dbpass) or die ("Could > not connect to database"); > $db = mysql_select_db($dbname) or die ("could not select db."); > $result = mysql_query($sql,$connection) or die ("Could > not execute query"); > > The variables $date etc are from a POST form input > > Any ideas? > > Toby > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Multiply Auto_Increments
Richard, Here is the code $sql = " INSERT INTO $table (id,date,user,title,brief,body,expires,visible) VALUES(NULL,\"$date\",\"$user\",\"$title\",\"$brief\",\"$body\",\"$exdate\", \"1\") "; $connection = mysql_connect($dbhost, $dbusername, $dbpass) or die ("Could not connect to database"); $db = mysql_select_db($dbname) or die ("could not select db."); $result = mysql_query($sql,$connection) or die ("Could not execute query"); The variables $date etc are from a POST form input Any ideas? Toby -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Multiply Auto_Increments
Sounds like a looping problem in your code. Can you supply the code around your INSERT statement so we can see what's going on? The only times I've experienced anything Roswell about MySQL is when I've written bad code. Rich > -Original Message- > From: Toby Parkins [mailto:toby@;uknetweb.com] > Sent: Wednesday, November 13, 2002 1:42 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Multiply Auto_Increments > > > Hi > > When ever I INSERT into a table with the values NULL into the ID > (AUTO_INCREMENT) field it adds in 1-4 extra blank records after. These > records have an AUTO_INCREMENT field which increases (+1) each time. > > Has anyone experienced this? > > Thanks, > > Toby Parkins > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php