Site Archives php sql pear
Execute SQL script from a file using PHP
The code below allows to retrieve and execute all SQL statements defined in a SQL script file removing all comments.
<?php
$sql_file = 'test.sql';
$contents = file_get_contents($sql_file);
// Remove C style and inline comments
$comment_patterns = array('/\/\*.*(\n)*.*(\*\/)?/', //C comments
[...]
Find It Quickly
Find what you're looking for quickly by using our keyword search. Can't find it? Try our links below.


