Jump to content


Photo

ODBC error


  • Please log in to reply
1 reply to this topic

#1 mrmoz

mrmoz
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 24 March 2006 - 11:27 AM

HI I'm being forced to use Access 2003 instead of MySQL and ma having loads of problems I am unable to create an ODBC connection so I have to do it all in the code. The mani problem I'm having at the moment seems incredibably simple but I can't figure it out. I keep on getting a syntax error for the below code can anybody help?

Thanks in advance

Moz!

// Microsoft Access connection string
$conn=new COM("ADODB.Connection") or die("Cannot start ADO");
$conn-> open("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Jet OLEDB:Database Password=o***;Data Source=***;");


$conn -> execute("UPDATE Perfumes
SET Perfdesc=$perfd
WHERE ID=$number
LIMIT 1");

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 24 March 2006 - 11:54 AM

I'm guessing that Perfdesc is a character field so $perfd needs to be quoted

$conn -> execute("UPDATE Perfumes
SET Perfdesc = '$perfd'
WHERE ID = $number");

PS Access doesn't have LIMIT.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users