Jump to content

[SOLVED] Inserting into multiple tables


unknown101

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/104535-solved-inserting-into-multiple-tables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.