2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
// some code
<?php /** * Installs all tables in the mysql.sql file, using the default mysql connection */ /* Change and uncomment this when you need to: */ mysql_connect ( 'localhost' , 'root' ) ; if ( mysql_errno ( ) ) { die ( ' Error ' . mysql_errno ( ) . ': ' . mysql_error ( ) ) ; } mysql_select_db ( 'oauthdemo' ) ; $sql = file_get_contents ( dirname ( __FILE__ ) . '/mysql.sql' ) ; $ps = explode ( '#--SPLIT--' , $sql ) ; foreach ( $ps as $p ) { $p = preg_replace ( '/^s*#.*$/m' , '' , $p ) ; mysql_query ( $p ) ; |