Reputation: 3
I am getting this error
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ''., SQL state 37000 in SQLExecDirect in D:\wamp\www\STAPP\sys_admin\1.php on line 23
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ''., SQL state 37000 in SQLExecDirect in D:\wamp\www\STAPP\sys_admin\1.php on line 23
<?php
require_once("../includes/database_connection.php");
$conn=odbc_connect('stapp','','');
if ( isset( $_FILES['userfile'] ) )
{
$csv_file = $_FILES['userfile']['tmp_name'];
if ( ! is_file( $csv_file ) )
exit('File not found.');
$sql = '';
if (($handle = fopen( $csv_file, "r")) !== FALSE)
{
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
{
$sql = "INSERT INTO `table` SET `column0` = '$data[0]',
`column1`= '$data[1]', `column2` = '$data[2]';";
$rs1=odbc_exec($conn,$sql);
}
fclose($handle);
}
// Insert into database
//exit( $sql );
exit( "Complete!" );
}
?>
Line number 23 is $rs1=odbc_exec($conn,$sql);
Can any please help me in the sql statement
Upvotes: 0
Views: 3685