I have two scripts that connect to an MS SQL 2000 server, using unixODBC.
This one works:
$odbc_db_conn = odbc_connect('SIS', 'sa', '');
$qstring = "SELECT * FROM Event, Service WHERE Event.ServiceID = Service.ServiceID ORDER BY Event.ServiceID, Event.StartDateTime ASC";
$res = odbc_exec($odbc_db_conn, $qstring);
while(odbc_fetch_row($res))
{
odbc_fetch_into($res, $details, 1);
echo "$details[1]:$details[12]:$details[4]-$details[5]<br /><br />\n";
}
echo "ODBC Error: ".odbc_error();
}
whereas this one throws up an odd error:
$si_db_conn = odbc_connect('SIS', 'sa','') or die("Couldn't Connect to MSSQL");
/$qstring = "USE CopEPG";
odbc_exec($si_db_conn, $qstring);/
$epg_regions = explode("|",get_epg_regions($state));
//echo $epg_regions;
//$epg_array = split("|",$epg_regions);
foreach($epg_regions as $reg_data)
{
$reg_data = explode("_", $reg_data);
$qstring = "SELECT FROM Service";
$res = odbc_exec($si_db_conn, "SELECT FROM Event, Service WHERE Event.ServiceID = Service.ServiceID ORDER BY Event.ServiceID, Event.StartDateTime ASC");// or die("Error: $qstring<br />".odbc_errormsg());
}
}
The error that gets thrown up from this is below:
Warning: SQL error: X’V ¾ÿ¿Ø¾ÿ¿|GB ¾ÿ¿†£ó@¿ÿ¿X’V, SQL state 00000 in SQLExecDirect in /var/www/html/winintranet/tvguide/inc/sci_atlanta_funcs.php on line 37
Any help would be appreciated.
Thanks