diff options
| author | Horus3 | 2014-02-25 19:20:09 +0100 |
|---|---|---|
| committer | Horus3 | 2014-02-25 19:20:09 +0100 |
| commit | aca3a7a20547aaee220300b570d070e4c6fe9869 (patch) | |
| tree | e756f3cc57d3eba1c55808acdcdf9337bca76a71 /www/insertfile.php | |
| parent | de391af1ff6695bd5bf52d08bd4b1512cfc524b3 (diff) | |
| parent | f254f1553d06953083c66620c6257682355064d1 (diff) | |
| download | random-aca3a7a20547aaee220300b570d070e4c6fe9869.tar.gz | |
Merge branch 'master' of git.iamfabulous.de:random
Diffstat (limited to 'www/insertfile.php')
| -rw-r--r-- | www/insertfile.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/www/insertfile.php b/www/insertfile.php index 5e07130..8053eb5 100644 --- a/www/insertfile.php +++ b/www/insertfile.php @@ -7,19 +7,25 @@ $bool = false; $db = new SQLite3("../database/dict.db"); + if($file = file($dic)){ $rows = count($file); for($i=0;$i<$rows;$i++){ + + $file[$i] = preg_replace("/\/(.*)$/", "", $file[$i]); +// echo "#" . $i . ": " . $file[$i] . "<br>"; + if(!$db->exec(" BEGIN TRANSACTION; - INSERT INTO " . $table " VALUES (NULL, " . $file[$i] . "); + INSERT INTO " . $table . " VALUES (NULL, \"" . $file[$i] . "\"); COMMIT; ")){ echo "Failure writing to the database at row" . $i ."!"; $bool = true; break; } + } if(!$bool){ |
