i keep getting the following error:
this happens with the following code:Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC Drivers<br/><b>Description:</b> [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'WHERE'.' in D:\wwwroot\gispen.net\gispen\periculum\dbaseconvert.php:43 Stack trace: #0 D:\wwwroot\gispen.net\gispen\periculum\dbaseconvert.php(43): com->Execute('INSERT INTO dbo...') #1 {main} thrown in D:\wwwroot\gispen.net\gispen\periculum\dbaseconvert.php on line 43
Code: Select all
$rs = $objConn->Execute("SELECT DATEPART (mm, datum) AS maand,
DATEPART(week, datum) as weeknummer, DATEPART(yyyy, datum)AS jaar
FROM dbo.gispen_printer_stats
WHERE (naam = 'PR0150') AND (datum = '2006-7-25')");
while (!$rs->EOF) //starting loop
{
// getting data from the query
$weeknummer = $rs->Fields['weeknummer']->value;
$maand = $rs->Fields['maand']->value;
$jaar = $rs->Fields['jaar']->value;
echo "$maand <br>"; // output is 7
echo "$weeknummer<br>"; // output is 3
echo "$jaar<br>"; // output is 2006
$rsc = $objConn->Execute("INSERT INTO dbo.gispen_printer_stats (MaandNummer, Weeknummer, Jaar)
VALUES ('$maand', '$weeknummer', '$jaar')
WHERE (naam = 'PR0150') AND (datum = 2006-7-25)"); // Line 43
$rs->MoveNext(); // end loop
}but for as far as i can tell all the code is correct.
can any of you see my mistake here?