I am using the PHP system function on windows as follows:
system("mysql --user=root --password=xxxx --host=127.0.0.1 --verbose <create.sql > out.txt 2>&1", $retVal);
But the error messages apppear at the top of the file. Is it possible to get the error messages to appear after the appropriate line of SQL that has the error.