Posts Tagged: php

How to Insert Data with PHP PDO

Here’s one way to insert a record using PHP PDO into a MySQL database. $dbh = new PDO(‘mysql:host=localhost;dbname=myfunkydata’, ‘dbusername’, ‘dbpassword’); $dbh->beginTransaction(); $sth = $dbh->prepare(“INSERT INTO recording(name, date) VALUES(?, ?)”); $file = time(); $sth->execute(array($file, date(‘Y-m-d H:i:s’, $file))); $dbh->commit();

How to Create PHP PDO MySQL Connection

Here’s how I create a PDO connection to a MySQL database. $dbh = new PDO(‘mysql:host=localhost;dbname=myfunkydata’, ‘dbusername’, ‘dbpassword’); $dbh->beginTransaction(); $sth = $dbh->prepare(“INSERT INTO recording(name, date) VALUES(?, ?)”); $file = time(); $sth->execute(array($file, date(‘Y-m-d H:i:s’, $file))); $dbh->commit();

Symfony Peeve: Inconsistent Namespace References

One thing that peeves me about Symfony is that it’s inconsistent in how it expects the user to refer to what’s seemingly the same thing. For instance, if you want to create a bundle with the command-line tool, you would do something like this. php app/console generate:bundle –namespace=Acme/Bundle/BlogBundle That’s fine, but then when you want… Read more »

Upgrading Debian Squeeze to Wheezy

I’ve recently done a few upgrades of Debian from Squeeze to Wheezy and it’s a pretty uneventful process. I recommend following these instructions at HowtoForge. The only major issue was that Mysql was removed after the upgrade. My data was still there but I had to install mysql-server. apt-get mysql-server Also you might get an… Read more »

Symfony 2 Getting Started Guide Now Available

It is here folks. The moment you have all been waiting for. My new Symfony 2 Getting Started tutorial is here. This is a simple and powerful tutorial that will get your through many of the core components of building applications using open source Symfony. I love Symfony, and I think you will too, so… Read more »