hi I have a project about a backoffice
and i am working with query every day (I am not a specialist of MySql);
i have noted this strange behaviour:
this code work well but is not perfect two many query
.....
$kao_query = "INSERT INTO ".UTEN_TAB." VALUES ('', '$nome_ut', '$cognome_ut', '$userid', '$password', '$fid_soc')";
$kao_query2 = "INSERT INTO ".ACCESS_TAB." VALUES (LAST_INSERT_ID(),'NULL','180')";
$kao_resp = mysql_db_query(DBNAME,$kao_query)
or die(mysql_errno().":".mysql_error()."-".mysql_close($kao_link));
$kao_resp2 = mysql_db_query(DBNAME,$kao_query2)
or die(mysql_errno().":".mysql_error()."-".mysql_close($kao_link));
.....
this code is two query in one php request:
.......
$kao_query = "INSERT INTO ".UTEN_TAB." VALUES ('', '$nome_ut', '$cognome_ut', '$userid', '$password', '$fid_soc')";
$kao_query .= "INSERT INTO ".ACCESS_TAB." VALUES (LAST_INSERT_ID(),'NULL','180')";
...........
1064:You have an error in your SQL syntax near 'INSERT INTO accessi VALUES (LAST_INSERT_ID(),'NULL','180')' at line 1-1
Is there someone that can explain why thi happen?
thanks
and i am working with query every day (I am not a specialist of MySql);
i have noted this strange behaviour:
this code work well but is not perfect two many query
.....
$kao_query = "INSERT INTO ".UTEN_TAB." VALUES ('', '$nome_ut', '$cognome_ut', '$userid', '$password', '$fid_soc')";
$kao_query2 = "INSERT INTO ".ACCESS_TAB." VALUES (LAST_INSERT_ID(),'NULL','180')";
$kao_resp = mysql_db_query(DBNAME,$kao_query)
or die(mysql_errno().":".mysql_error()."-".mysql_close($kao_link));
$kao_resp2 = mysql_db_query(DBNAME,$kao_query2)
or die(mysql_errno().":".mysql_error()."-".mysql_close($kao_link));
.....
this code is two query in one php request:
.......
$kao_query = "INSERT INTO ".UTEN_TAB." VALUES ('', '$nome_ut', '$cognome_ut', '$userid', '$password', '$fid_soc')";
$kao_query .= "INSERT INTO ".ACCESS_TAB." VALUES (LAST_INSERT_ID(),'NULL','180')";
...........
1064:You have an error in your SQL syntax near 'INSERT INTO accessi VALUES (LAST_INSERT_ID(),'NULL','180')' at line 1-1
Is there someone that can explain why thi happen?
thanks