hi guys
i would appriciate your coments on this code - when i ran it for the very first time it doesnt see @last = LAST_INSERT_ID( ) but when i ran it next time it read it properly i need to know it imiedietely after i insert value into session1...
is there any other way to do it? insert into 2 tables at the same time ...?
[PHP]
if(!($sessid)){
session_registe r('sessid');
mysql_query("in sert into session1 set
sessid=null,
ip='$ip',
ip2='$ip2',
cook=$cook,
time='$time',
user='$Guser',
pass='$pass',
ile='0'
");
//this doesnt work imiedietly last=0 - next time i run the script its ok ..
//it doesnt seem to see that i did inserted a values into session1.
$id5=mysql_quer y("SELECT @last := LAST_INSERT_ID( )");
$sessid1=mysql_ fetch_array($id 5);
$sessid=$sessid 1[0];
mysql_query("in sert into session2 set
sessid=@last,
browser='$GLOBA LS[HTTP_USER_AGENT]',
lang='$GLOBALS[HTTP_ACCEPT_LAN GUAGE]',
host='$GLOBALS[HTTP_HOST]',
accept='$GLOBAL S[HTTP_ACCEPT]',
referer='$GLOBA LS[HTTP_REFERER]',
");
}[/PHP]
thanks a lot
jx2
i would appriciate your coments on this code - when i ran it for the very first time it doesnt see @last = LAST_INSERT_ID( ) but when i ran it next time it read it properly i need to know it imiedietely after i insert value into session1...
is there any other way to do it? insert into 2 tables at the same time ...?
[PHP]
if(!($sessid)){
session_registe r('sessid');
mysql_query("in sert into session1 set
sessid=null,
ip='$ip',
ip2='$ip2',
cook=$cook,
time='$time',
user='$Guser',
pass='$pass',
ile='0'
");
//this doesnt work imiedietly last=0 - next time i run the script its ok ..
//it doesnt seem to see that i did inserted a values into session1.
$id5=mysql_quer y("SELECT @last := LAST_INSERT_ID( )");
$sessid1=mysql_ fetch_array($id 5);
$sessid=$sessid 1[0];
mysql_query("in sert into session2 set
sessid=@last,
browser='$GLOBA LS[HTTP_USER_AGENT]',
lang='$GLOBALS[HTTP_ACCEPT_LAN GUAGE]',
host='$GLOBALS[HTTP_HOST]',
accept='$GLOBAL S[HTTP_ACCEPT]',
referer='$GLOBA LS[HTTP_REFERER]',
");
}[/PHP]
thanks a lot
jx2
Comment