PHP PDO help...

SpaceshipSpaceship
Watch

klarth

Established Member
Impact
11
I'm having some problems with PDO. Here's my code:

$db = new PDO('sqlite:main.db');
$db->exec("insert into stuff (name) values ('asfasdf');");

I don't get any errors, but the value isn't being inserted into the database. Selects work though, but deletes and inserts don't. What am I doing wrong?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Can you echo the statement and execute it on phpmyadmin for example ?
Also, 'name' may be a reserved keyword so you may want to rename that field or use backticks around it, like this:
PHP:
insert into stuff (`name`) values ('asfasdf');
 
0
•••
chmod +0777 main.db
 
0
•••
Tried both, didn't work. :(
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back