since you cannot automatically increase two columns so that Query would get the last row of the table and the value of +1 column to insert a new row.
For example, I have a table called players
looks like that:
id player_id player_name 1 15 name1 2 16 name2 3 17 name3
I am trying to create an admin panel to create a player from a form, and the number of id identifiers automatically increases, but I also need player_id to increase too, but id and player_id do not match.
A query like this (I did this so you can understand a little better)
$sql="select top 1 * from `players` order by id desc"; $result =mysql_query($sql); while ($data=mysql_fetch_assoc($result)){ $playerid=$data['player_id']; Insert into `players` (`player_id`,`player_name`) VALUE ('$playerid' + '1', 'name4'); }
source share