|
Posted by on 08/25/05 19:39
i'm using iis on win xp, php 5, and mysql 4.1. php connects to mysql using
an odbc connection string. i don't use the built-in mysql or odbc functions
to prepare/execute queries...i create a com ado object...but that's another
story.
what i want to know how to do is run a query having multiple statements. is
there a param on the connection string that could be used? do i not have the
syntax correct?
a basic example would be:
$sql = "
LOCK TABLES webPages WRITE;
INSERT INTO webPages
(
Description,
Url,
Category,
ViewOrder,
Restricted
)
VALUES
(
'$description',
'$url',
'$category',
'$viewOrder',
'$requiresLogin'
);
SELECT LAST_INSERT_ID() Id;
UNLOCK TABLES;
";
the error i get when this executes is:
Fatal error: Uncaught exception 'com_exception' with message 'Source:
Microsoft OLE DB Provider for ODBC Drivers
Description: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ';
INSERT INTO webPages ( Descr' at line 1' in
C:\Inetpub\wwwroot\automation\inc\functions.php:8 Stack trace: #0
C:\Inetpub\wwwroot\automation\inc\functions.php(8): com->Execute('? ...') #1
C:\Inetpub\wwwroot\automation\web.pages.php(169): dbFetchAssoc(Object(com),
'? ...') #2 {main} thrown in C:\Inetpub\wwwroot\automation\inc\functions.php
on line 8
any help or insight you could provide would be well received and
appreciated.
tia,
me
Navigation:
[Reply to this message]
|