Quote:
Originally Posted by Grim_
fread only reads one line of the file at a time. You'll need to read the whole file, then execute the query.
pawn Код:
stock CreateSQLTables( ) { new szQuery[ 2000 ]; new szLine[ 128 ]; new File: sqltables = fopen( "sql.txt", io_read ); while( fread( sqltables, szLine ) ) { strcat( szQuery, szLine ); // You may need to add \n to the end of the line due to syntax } fclose( sqltables ); mysql_query( szQuery ); }
|
Oh! I thought fread() reads the whole file, without dealing with particular lines or whatever. Thank you! Oh and by the way, how would someone go about using the queries in the file posted above inside the script? I never really attempted doing this and cba. to check the code of another script.