本文整理汇总了PHP中Feedback::loadFromResult方法的典型用法代码示例。如果您正苦于以下问题:PHP Feedback::loadFromResult方法的具体用法?PHP Feedback::loadFromResult怎么用?PHP Feedback::loadFromResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feedback
的用法示例。
在下文中一共展示了Feedback::loadFromResult方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findByHash
/**
* Create an instance by the hash value. This function is in support
* of the synchronization functionality. It takes a hash value and
* it will return an instance of the object for that hash value
* if the hash exists. If the hash does not exist, null will be
* returned, indicating that the object should be created using the
* normal constructor.
*/
public static function findByHash($hash = '')
{
if (!isset($hash) || $hash === '') {
return null;
}
$hashValue = db_sql_encode($hash);
$query = "SELECT * FROM blogFeedback " . "WHERE hash={$hashValue} " . "ORDER BY updated DESC " . "LIMIT 1";
$result = mysql_query($query);
if (!$result) {
// Error executing the query
print $query . "<br/>";
print " --> error: " . mysql_error() . "<br/>\n";
return null;
}
if (mysql_num_rows($result) <= 0) {
// Object does not exist
return null;
}
// Create an instance with a special ID '-' to bypass the
// checks on empty ID. The ID value will be overwritten by the
// value coming back from the database anyway.
$object = new Feedback('-', '-', '-');
if ($object->loadFromResult($result)) {
return $object;
}
return null;
}