Solarpitch Posted June 24, 2007 Share Posted June 24, 2007 Is anyone familiar with the way phpbb works in terms of adding a new user to the database. If i am right it doesnt seem to auto increment? When a new user registers fir my site, I also have an sql insert into the phpbb_user table too so they can then logon to the forum. But the id seems to go in as just 0 and wont increment! Is there any reason for this? Link to comment https://forums.phpfreaks.com/topic/56983-solved-phpbb-auto-increment-question/ Share on other sites More sharing options...
chocopi Posted June 24, 2007 Share Posted June 24, 2007 what you need to do it pull the highest value from the table and then increment it using ++ and it should work as i use something similar <?php $query = mysql_query("SELECT MAX(field1) AS `field1` FROM `table` WHERE field2='$var'") or die(mysql_error()); $fetch= mysql_fetch_assoc($query) or die(mysql_error()); $post_num = $fetch['field1']; $post_num++; ?> Hope it helps ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/56983-solved-phpbb-auto-increment-question/#findComment-281475 Share on other sites More sharing options...
Solarpitch Posted June 24, 2007 Author Share Posted June 24, 2007 Brilliant! I was trying that already but my code was wrong! Thanks for that! Link to comment https://forums.phpfreaks.com/topic/56983-solved-phpbb-auto-increment-question/#findComment-281476 Share on other sites More sharing options...
chocopi Posted June 24, 2007 Share Posted June 24, 2007 no problem, its quite lucky as i have recently been creating a mini forum so i had the code on hand for you Link to comment https://forums.phpfreaks.com/topic/56983-solved-phpbb-auto-increment-question/#findComment-281477 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.