unknown101 Posted May 7, 2008 Share Posted May 7, 2008 Hi guys, im using an ID3 extraction class but have slightly modified some of the functions. I have the following queries which are causing me a problem, which are run within an elseif statement: $SQLquery = 'INSERT INTO artist_tbl (`Artist`, `Genre`) VALUES ('; $SQLquery .= '"'.mysql_escape_string(@implode("\t", @$ThisFileInfo['comments']['artist'])).'", '; $SQLquery .= '"'.mysql_escape_string(@implode("\t", @$ThisFileInfo['comments']['genre'])).'") '; $SQLquery = 'INSERT INTO track_tbl (`Track`, `FilePath`, `filesize`, `fileformat`, `bitrate`, `playtime_seconds`) VALUES ('; $SQLquery .= '"'.mysql_escape_string($this_track_title).'", '; $SQLquery .= '"'.mysql_escape_string(@$ThisFileInfo['filenamepath']).'", '; $SQLquery .= '"'.mysql_escape_string(@$ThisFileInfo['filesize']).'", '; $SQLquery .= '"'.mysql_escape_string(@$ThisFileInfo['fileformat']).'", '; $SQLquery .= '"'.mysql_escape_string(@$ThisFileInfo['audio']['bitrate']).'", '; $SQLquery .= '"'.mysql_escape_string(@$ThisFileInfo['playtime_seconds']).'") '; Orginally the script enters all data into a single table so there was only 1 query, I want to seperate certain data into different tables, so I have created the above. Both queries work, but when i run the script only the last one within the elseif statement works, so its overwriting the previous. Is it possible to put this all into one big INSERT statement.. if so could someone give me a hand with the syntax? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/104535-solved-inserting-into-multiple-tables/ Share on other sites More sharing options...
fenway Posted May 7, 2008 Share Posted May 7, 2008 You can't combine two statements into one query. So use a second variable, and run both. Quote Link to comment https://forums.phpfreaks.com/topic/104535-solved-inserting-into-multiple-tables/#findComment-535156 Share on other sites More sharing options...
unknown101 Posted May 8, 2008 Author Share Posted May 8, 2008 Thanks for that, works fine now:) Quote Link to comment https://forums.phpfreaks.com/topic/104535-solved-inserting-into-multiple-tables/#findComment-536086 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.