The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieving details from a Database to table
#5
Code:
$db->findAll("customers");
Code:
$exclude = ["id","lname","password"];
Code:
$halve   = ["fname"];

Code:
if (!$db->error() && $db->count()>0) {
Code:
$customers = $db->results(true);
Code:
echo "<TABLE CLASS=\"table\"><TR>";

Code:
foreach ($customers[0] as $key=>$value)
Code:
if (!in_array($key,$exclude))
Code:
echo "<TH>$key</TH>";

Code:
echo "</TR>";

Code:
foreach ($customers as $customer) {
Code:
echo "<TR>";

Code:
foreach ($customer as $key=>$value)
Code:
if (!in_array($key,$exclude)) {
Code:
echo "<TD>";

Code:
if (in_array($key,$halve))
Code:
echo substr($value, 0, strlen($value)/2);
Code:
else
Code:
echo "$value";

Code:
echo "</TD>";
Code:
}

Code:
echo "</TR>";
Code:
}

Code:
echo "</TABLE>";
Code:
}
  Reply


Messages In This Thread
Retrieving details from a Database to table - by faguss - 07-06-2017, 08:08 AM

Forum Jump:


Users browsing this thread: 3 Guest(s)