I am working on a php code as shown below which scans the directory ($src_dir) and list all mp4 files.
$src_dir = ('\\\ABCD-ST-001\Audio_Test\podcast\incoming_folder');
$mp4_files = preg_grep('~\.(mp4)$~', scandir($src_dir));
print_r(array_values($mp4_files)); // LineA
Here is the O/P obtained from Line#A:
Array ( [0] => 36031P.mp4 [1] => hello.mp4 )
I am getting two values at Index 0 and Index 1. The 1st is 36031P.mp4 and 2nd is hello.mp4
After that I have wrote a script which insert data in table Podcast_Export.
$db->exec("INSERT INTO Podcast_Export ('House#', 'Status') VALUES ('array_values($mp4_files)', 'Go')"); /* have to place this question on SO*/
On running the above script, I am getting the following data inside the table which is not I want.
array_values(Array) Go
array_values(Array) Go
Problem Statement:
I am wondering what changes I should make in the script above so that it inserts the following data inside the table:
36031 Go
hello Go
class MyDB extends SQLite3 { function __construct() { $this->open('database/Podcast.db'); } } $db = new MyDB(); if(!$db) { echo $db->lastErrorMsg(); } else { echo "Opened database successfully<br>"; }