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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.