Skip to content Skip to sidebar Skip to footer

How To Avoid Adding Redundant Data In Sqlite Table Using Php?

I am working on a php code as shown below which lists all the mp4 files present in a $src_dir. $src_dir = ('\\\ABCD-ST-001\Audio_Test\podcast\incoming_folder'); $mp4_files = preg

Solution 1:

Your selection is fine, but you need to store result into an variable like:

$count = $db->querySingle("SELECT COUNT(*) as count FROM Podcast_Export WHERE House_number = '".$value."'"); 
if($count <= 0){ 
    $db->exec("INSERT INTO Podcast_Export (House_number,Status) 
               VALUES ('".$value."', 'Go')");
}

Using querySingle to get the no of rows in SQLite.

note that, i have chanaged the House# to House_number here and removed AND status = 'GO' clause as all of them having GO status.

Post a Comment for "How To Avoid Adding Redundant Data In Sqlite Table Using Php?"