RAH Posted September 25, 2007 Share Posted September 25, 2007 Hello, The id collumn is setup for auto increment however how do I modify the following code to achieve this? insert into vhc_items (id, cid, name, time, pic, description, link, hidden, filter, clicks, weekclicks, clickslog, pin, starttime, endtime) values ('9999999', '1', '".addslashes($title)."', '1189875417','" . addslashes($md5) . ".png', '" . addslashes($descr) . "' ,'" . addslashes($md5) . ".flv','0', '0', '0', '0', '4|0|0|0|0|0|0|1189983109', '0', '0', '0') Thanks. Link to comment https://forums.phpfreaks.com/topic/70550-solved-auto-increment/ Share on other sites More sharing options...
Barand Posted September 25, 2007 Share Posted September 25, 2007 Either omit id from the columns and 999999 from the values, or write NULL to te id column INSERT INTO table (id, col1) VALUES (NULL, 'someval') or INSERT INTO table (col1) VALUES ('someval') Link to comment https://forums.phpfreaks.com/topic/70550-solved-auto-increment/#findComment-354483 Share on other sites More sharing options...
RAH Posted September 25, 2007 Author Share Posted September 25, 2007 Hello, Yes, I originally removed the ID column and value from the insert statement however by doing this or NULL I get this error: Duplicate entry '2147483647' for key 1 Link to comment https://forums.phpfreaks.com/topic/70550-solved-auto-increment/#findComment-354484 Share on other sites More sharing options...
Barand Posted September 25, 2007 Share Posted September 25, 2007 Specify the id field as unsigned so you can hold more than 2,147,483,647 rows. Link to comment https://forums.phpfreaks.com/topic/70550-solved-auto-increment/#findComment-354486 Share on other sites More sharing options...
RAH Posted September 25, 2007 Author Share Posted September 25, 2007 Hello, How do I specify it as unsigned? Thanks. Link to comment https://forums.phpfreaks.com/topic/70550-solved-auto-increment/#findComment-354773 Share on other sites More sharing options...
Barand Posted September 25, 2007 Share Posted September 25, 2007 http://dev.mysql.com/doc/refman/4.1/en/alter-table.html Link to comment https://forums.phpfreaks.com/topic/70550-solved-auto-increment/#findComment-354791 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.