ODBC connection to MSAccess



Hi I'm connecting to an Access 2003 DB with PHP 4 and attmepting to update a table but I get syntax error everytime can anyone explain? my code is below.

Thanks in advance.

// 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=***;Data Source=****;");

$conn -> execute("UPDATE Perfumes SET Perfdesc=$perfd WHERE ID=$number LIMIT 1");
I'm not sure as I'm not connected to that network from home but I think it was a syntax error that had something todo with Jet4. I fixed the problem by replacing the update query with a delete and insert but am still interested as to why it didn't work.

Could it be that Perfdesc is a textfield? In that case you need to enclose $perf with single quotes ( ' ).

If you can post your insert query, we might be able to explain why the update fails.

Yeah I tried with quotes round Perfdesc but I've just noticed that I've probablt done something very stupud and changed the field name and not the query. Which wouldn't help!

Thanks guys.
The funny is that sometimes we're so sure about what we've done and even looking to the code we can't see we miss a quote or comma :) That happens ;)
Sounds familiar :) That's why it's always good to have someone else look at your code. A fresh view does miracles.