View Full Version : cant figure out how to increase the id...
killaklown
Oct 12th 2006, 6:39 pm
i have:
$i=0;
$i++;
but how can i make it so that $i++ will increase for each of the new table rows?
IE:
ID | Name
1 | Test
2 | Another Test
Right now it will just show:
ID | Name
1 | Test
1 | Another Test
(the information is coming from my database)
Edit: nvm, had $i=0; in the wrong spot... heh
azizny
Oct 12th 2006, 6:47 pm
If you are using the database, use auto increment instead.
Peace,
gigamike
Oct 13th 2006, 11:51 am
hi killaklown,
if youre using a databse, use the auto icrement feature of it. here is an example taken from MySQL database.
CREATE TABLE `users` (
`id` int(5) NOT NULL auto_increment,
`username` varchar(10) NOT NULL default '',
`password` varchar(10) NOT NULL default '',
`lastname` varchar(35) NOT NULL default '',
`firstname` varchar(35) NOT NULL default '',
`email` varchar(35) NOT NULL default '',
PRIMARY KEY (`id`)
)
once you insert new record to your database, it will automatically provides you with an incremented id
thanks,
gigamike
i have:
$i=0;
$i++;
but how can i make it so that $i++ will increase for each of the new table rows?
IE:
ID | Name
1 | Test
2 | Another Test
Right now it will just show:
ID | Name
1 | Test
1 | Another Test
(the information is coming from my database)
Edit: nvm, had $i=0; in the wrong spot... heh
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.