Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Inserting one data to two different table and field..

Aloittaja SinekSekiz, heinäkuu 24, 2007, 01:45:28 IP

« edellinen - seuraava »

SinekSekiz

Hi

I have an on-line game and I would like to ad Alliance future in it. But I have a problem about inserting datas to 2 different table;

I need to get 3 input from the user. These are aLogin, aLogo, aTag after I get these 3 input I need to add all of them to alliance and aLogin to user.

I have tried many ways but last one is this;
//1th part
$query = "INSERT INTO `alliances` ";
$query .= "( `aLogin` , `aLogo` , `aTag` , `aID`) ";
$query .= "VALUES (\"$thealliance\", \"$thelogo\", \"$thetag\", \"$randcode\")";
$db->query($query);
$linsrt = mysql_insert_id();
//2nd part
$query2 = "INSERT INTO `users` ";
$query2 .= "( `uAlliance`) ";
$query2 .= "VALUES (\"$thealliance\")";
$db->query($query2);
$linsrt = mysql_insert_id();

I definitely am doing something wrong. Because the first part works as it should be but second part does not enter the value to the second table.
You know you want to use it... So use it.

Dulce et Decorum est Pro SinekSekiz Mori

We are all figures. For men it's the money in your bank. For women it's the cup size of your boobs.

SinekSekiz

Sorry guys I have solved problem. It was a simple syntax error in the form.

Thank you.
You know you want to use it... So use it.

Dulce et Decorum est Pro SinekSekiz Mori

We are all figures. For men it's the money in your bank. For women it's the cup size of your boobs.

Advertisement: