That is because "source" is a mysql client command, not as sql command. It gets executed by the client 'mysql'. The 'mysql' client reads it line by line, and passes the lines to the server. The server never sees the scriptfile.sql. You will have to write a PHP modules that reads the file, and passes it lin-by-line to the server, or have PHP execute the mysql client, passing it all options and parameters.
Stephen Wardlaw wrote: >When in MySQL in a terminal, if I enter the command "source scriptfile.sql", >MySQL correctly executes the source file. > >However, if using PHP, I execute the following commands in a PHP file: > ><?php > // data base is connected... > >$query = "source scriptfile.sql"; >$result = mysql_query($query); > >I get a MySQL "Query Error - You have an error in your SQL syntax near >'source scriptfile.sql' at line 1". > >I have tried numerous combinations of parentheses, single quotes and relative >and absolute file paths. > >Can someone please tell me what I am doing wrong? > >Stephen Wardlaw >Yale labs > > >--------------------------------------------------------------------- >Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > >To request this thread, e-mail <[EMAIL PROTECTED]> >To unsubscribe, e-mail ><[EMAIL PROTECTED]> >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php