NogDog;1216396 wrote:However, more robust code would have first checked that $STH was not false -- unless they have enabled PDO::ERRMODE_EXCEPTION earlier in the code?
Yup, they had it on.
NogDog;1216396 wrote:Just to sort of help you get used to interpreting the manual...
Assuming $DBH is a PDO object, you'll see from the manual that PDO::prepare() returns a PDOStatement object (or false on failure). One of PDOStatment's methods is execute(), so that is now accessible from the $STH object.
Yeah, I always have the manual open in a tab, as I refer to it frequently. Though, to be honest, sometimes I don't understand what it's saying. If I can't get answers from the manual, I see if Google can provide me with a plain-English explanation. Sometimes this works; sometimes it doesn't.
If all else fails, I post on a PHP forum (usually this one.) It's nice to have a source of guidance from real live people--gotten me out of so many frustrating situations over the years. I don't handle frustration the greatest. I probably would have given up were it not for people like you all. 
Anyhoo, let's see if I get this.
$STH = $DBH->prepare("INSERT INTO folks ( first_name ) values ( 'Cathy' )");
$STH->execute();
PHP processed $DBH->prepare(), before it put it in $STH, so PDO::prepare() did not actually go in there, but rather its returned value did: PDO::execute(). Is this right?
I would try playing with this in my code, if I were not having a little problem. I just noticed that after removing mysql_query and mysql_select_db from my script, it's not connecting to MySQL anymore. Here is the relevant part of my code:
private $dbHost = 'myhost'; //changed from what it really was
private $dbUser = 'myusername'; //changed from what it really was
private $dbPass = 'mypassword'; //changed from what it really was
private $dbName = 'mydatabase'; //changed from what it really was
private $DBH = false;
public $result = array();
public function connect()
{
try
{
if (!$this->DBH)
{
$connectString="mysql:host={$this->dbHost};dbname={$this->dbName}, {$this->dbUser}, {$this->dbPass}";
$this->DBH = new PDO($connectString);
$DBH->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
}
}
catch (PDOException $e)
{
print $connectString.'<br /><br />'.$e->getMessage();
}
}
I used the $connectString variable just so, upon receiving an error, I could output it to the screen and make sure that the values (like dbName) were actually getting used.
When I visit the page in my browser I get (sensitive details changed):
mysql:host=myhost;dbname=mydatabase, myusername, mypassword
SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)012
I don't know how it can say it's not getting the username, or password, or anything. I see them right there in the string?