php - How do I insert into PDO (sqllite3)? -
I have trouble putting a SQLT3 database with PDAs, you have to forgive my ignorance with the PDO, It seems that the foreign Python database is coming from the interface.
So my problem is that I have a simple insert:
$ dbh = new PDO ('sqlite: vets.db'); $ Count = $ dbh- & gt; Exec ("name, email, clinic, street name, city location, link, phone, fax, animal, area, visible) value ($ name, $ email, $ clinic, $ pathname, $ citystatezip, $ link, $ Phone, $ fax, $ animal, $ area, $ visible) "); $ Dbh = null;
I just want to execute SQL commands on that database and should be done with it. Although there is no error in executing this script, it never updates the database. I have tried all the permissions on the database, even made 777 but it does not matter
Can anyone help me? One of the great benefits of PDO is that you can make prepared statements. I have some code from a PHP project:
$ qry = $ db- & gt; Prepare ('twocents (path, name, message INSERT) value (?,?,?)'); $ Qry- & gt; Execute (array ($ path, $ name, $ message));
As you can see, I ?
where I want to insert a value, then I execute the query with an array of values.
If you do this, then your query will be more secure, and more likely to work (since a missing value will prevent your query from working directly on your query in a query like yours .)
Comments
Post a Comment