Automatically adding tables/fields in MySQL database.
#6

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 );
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)