本文整理汇总了PHP中Preference::fromRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Preference::fromRow方法的具体用法?PHP Preference::fromRow怎么用?PHP Preference::fromRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preference
的用法示例。
在下文中一共展示了Preference::fromRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$empty = true;
$students = "";
$rows = $db->query("select * from Students order by lastName");
foreach ($rows as $key => $row) {
$student = Student::fromRow($row);
$students[$student->email] = $student;
}
// find active preference table
$activeTables = new ActiveTables($db);
$preferenceTable = $activeTables->getUniqueMatchingName('Preferences');
// do the query
$nTas = 0;
$preferences = "";
$rows = $db->query("select * from {$preferenceTable}");
foreach ($rows as $key => $row) {
$preference = Preference::fromRow($row);
$preferences[$preference->email] = $preference;
$nTas = $nTas + 1;
}
// start page
print '<article class="page">' . "\n";
print '<h1>All Active TA Preferences</h1>' . "\n";
print "<p>Number of TAs with registered preferences: {$nTas}</p>\n";
print "\n";
// print table header
print "<table>\n";
print "<tr>";
print "<th> Name </th>";
print "<th> Email </th>";
print "<th> Preference 1 </th>";
print "<th> Preference 2 </th>";