livewirerules Posted August 30, 2008 Share Posted August 30, 2008 how do i insert a value for two different tables in php using mysql? The following code inserts the value to the log table $sql = "INSERT INTO `log` (`tip`,`win`) VALUES('".$tip."','1')"; $res = mysql_query($sql) or die(mysql_error()); So i need two write a query to insert the values in to 2 tables log and templog How do i do it? Any help will be appreciated Link to comment https://forums.phpfreaks.com/topic/122004-multiple-queries-phpmysql/ Share on other sites More sharing options...
BlueSkyIS Posted August 30, 2008 Share Posted August 30, 2008 use 2 different insert statements, one for the first table and another for the second. Link to comment https://forums.phpfreaks.com/topic/122004-multiple-queries-phpmysql/#findComment-629738 Share on other sites More sharing options...
livewirerules Posted August 30, 2008 Author Share Posted August 30, 2008 isnt it possible to write it in one statement? Link to comment https://forums.phpfreaks.com/topic/122004-multiple-queries-phpmysql/#findComment-629745 Share on other sites More sharing options...
compguru910 Posted August 30, 2008 Share Posted August 30, 2008 No, its possible to insert two different statements into one table, but you cannot insert into two different tables at the same time. Link to comment https://forums.phpfreaks.com/topic/122004-multiple-queries-phpmysql/#findComment-629761 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.