db vs pdb confusion...
Jon Daley
plogworld at jon.limedaley.com
Sat Jan 27 18:57:27 EST 2007
I haven't ever quite understood how all the database stuff works.
I have a function that I was typing the mysql directly, and I thought that
perhaps I should use the Db::buildUpdateQuery instead. Is that the right
thing to do?
What I am missing is I don't know how to get to the Affected_Rows()
function, that exists in mysqldriver, but not mysqlrecordset.
function confirmSubscription($confirmation){
include_once( PLOG_CLASS_PATH."class/database/db.class.php" );
// $prefix = Db::getPrefix();
// $query = "UPDATE {$prefix}subscribe ".
// "SET active=1, confirm=NULL ".
// "WHERE confirm='$confirmation'";
$db =& Db::getDb();
$query = Db::buildUpdateQuery("subscribe",
array("active" => 1,
"confirm" => NULL),
array("confirm" => $confirmation));
if(!$db->Execute($query))
return false;
// TODO: check affected_rows, and make sure
// that it is at least 1.
return true;
}
--
Jon Daley
http://jon.limedaley.com/
To be upset over what you don't have is to waste what you do have.
-- Unknown
More information about the pLog-svn
mailing list