RSSAmplifier

Luca Corbo – · Jun 4, 2008

Execute Sql Script From a File Using PHP

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

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 '/\s*--.*\n/' , //inline comments start with -- '/\s*#.*\n/' , //inline comments start with # );…

Read on /blog/execute-sql-script-from-a-file-using-php/

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.