htorbov Posted February 12, 2012 Share Posted February 12, 2012 This: echo "<pre>"; print_r($torrent->content()); echo "</pre>"; Returns: Array ( [Eureka.S05E01.HDTV.XviD-ASAP\Eureka.S05E01.HDTV.XviD-ASAP.avi] => 367011826 [Eureka.S05E01.HDTV.XviD-ASAP\eureka.s05e01.hdtv.xvid-asap.nfo] => 4798 [Eureka.S05E01.HDTV.XviD-ASAP\Sample\eureka.s05e01.hdtv.xvid-asap.sample.avi] => 7883092 ) Needs to be inserted to MySQL like: In other words, the array $torrent->content() needs to be inserted to MySQL as new lines at columns "filename" and "size". Please help me.. Quote Link to comment https://forums.phpfreaks.com/topic/256933-php-keys-values-mysql-columns/ Share on other sites More sharing options...
htorbov Posted February 12, 2012 Author Share Posted February 12, 2012 Nevermind, I did it with: $torrentid = 1; foreach($torrent->content() as $filename => $size) { $sqldb->query("INSERT INTO files (torrent, filename, size) VALUES('{$torrentid}','{$filename}','{$size}')"); } Quote Link to comment https://forums.phpfreaks.com/topic/256933-php-keys-values-mysql-columns/#findComment-1317196 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.