I know this has a simple answer that I should know, but for the life of me, can't remember. I have the following update statement in my code:

$stmt = $pdo->prepare("UPDATE `files` SET `filename` = ?, `md5` = ?, `filesize` = ?,`logtime` = now() WHERE `id` = ?");
$stmt->execute (array($isoname, $md5file, $isosize2, 1)) ;

How do I test if the update was successful?

Thanks for the reply, rproffitt. The problem is that if I test like in the following code, it errors on the if statement.

$stmt = $pdo->prepare("UPDATE `files` SET `filename` = ?, `md5` = ?, `filesize` = ?,`logtime` = now() WHERE `id` = ?");
$stmt->execute (array($isoname, $md5file, $isosize2, 1)) ;
      if $stmt = false
         exit;

Got it fixed. Replaced execute and if statement as follows:

$stmt = $pdo->prepare("UPDATE `files` SET `filename` = ?, `md5` = ?, `filesize` = ?,`logtime` = now() WHERE `id` = ?");
$count= $stmt->execute ($isoname, $md5file, $isosize2, 1 ) ;
   if ($count==0) 
      echo ("Std update failed");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.