php 表格 foreach 显示 select 结果
- Written by alamise
- font size decrease font size increase font size
<?php $con = mysql_connect("localhost","tdg","tdg"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("tdg", $con); $result = mysql_query("SELECT * FROM `client`"); ?> <table border="2"> <?php while ($row = mysql_fetch_assoc($result)): ?> <tr> <?php foreach($row as $key=>$value) { echo "<td>$key: $value</td>\n "; } ?> </tr> <?php endwhile; ?> </table> <?php mysql_close($con); ?>
Last modified onMonday, 29 April 2013 13:18
( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0019 | 415640 | {main}( ) | .../index.php:0 |
2 | 0.1022 | 4720736 | Joomla\CMS\Application\SiteApplication->execute( ) | .../index.php:49 |
3 | 0.1022 | 4720736 | Joomla\CMS\Application\SiteApplication->doExecute( ) | .../CMSApplication.php:196 |
4 | 0.3499 | 12448920 | Joomla\CMS\Application\SiteApplication->dispatch( ) | .../SiteApplication.php:233 |
5 | 0.3510 | 12473264 | Joomla\CMS\Component\ComponentHelper::renderComponent( ) | .../SiteApplication.php:194 |
6 | 0.3522 | 12528592 | Joomla\CMS\Component\ComponentHelper::executeComponent( ) | .../ComponentHelper.php:377 |
7 | 0.3525 | 12557416 | require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ) | .../ComponentHelper.php:402 |
8 | 0.3639 | 12992824 | K2ControllerItem->execute( ) | .../k2.php:64 |
9 | 0.3639 | 12992824 | K2ControllerItem->display( ) | .../BaseController.php:710 |
10 | 0.3775 | 13718024 | K2ControllerItem->display( ) | .../item.php:78 |
11 | 0.3775 | 13718024 | K2ControllerItem->display( ) | .../controller.php:19 |
12 | 0.3838 | 14114392 | Joomla\CMS\Cache\Controller\ViewController->get( ) | .../BaseController.php:663 |
13 | 0.4011 | 14134760 | K2ViewItem->display( ) | .../ViewController.php:102 |
14 | 0.5148 | 17201120 | K2ViewItem->display( ) | .../view.html.php:742 |
15 | 0.5148 | 17201120 | K2ViewItem->loadTemplate( ) | .../HtmlView.php:230 |
16 | 0.5177 | 17381320 | include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ) | .../HtmlView.php:701 |
( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0019 | 415640 | {main}( ) | .../index.php:0 |
2 | 0.1022 | 4720736 | Joomla\CMS\Application\SiteApplication->execute( ) | .../index.php:49 |
3 | 0.1022 | 4720736 | Joomla\CMS\Application\SiteApplication->doExecute( ) | .../CMSApplication.php:196 |
4 | 0.3499 | 12448920 | Joomla\CMS\Application\SiteApplication->dispatch( ) | .../SiteApplication.php:233 |
5 | 0.3510 | 12473264 | Joomla\CMS\Component\ComponentHelper::renderComponent( ) | .../SiteApplication.php:194 |
6 | 0.3522 | 12528592 | Joomla\CMS\Component\ComponentHelper::executeComponent( ) | .../ComponentHelper.php:377 |
7 | 0.3525 | 12557416 | require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ) | .../ComponentHelper.php:402 |
8 | 0.3639 | 12992824 | K2ControllerItem->execute( ) | .../k2.php:64 |
9 | 0.3639 | 12992824 | K2ControllerItem->display( ) | .../BaseController.php:710 |
10 | 0.3775 | 13718024 | K2ControllerItem->display( ) | .../item.php:78 |
11 | 0.3775 | 13718024 | K2ControllerItem->display( ) | .../controller.php:19 |
12 | 0.3838 | 14114392 | Joomla\CMS\Cache\Controller\ViewController->get( ) | .../BaseController.php:663 |
13 | 0.4011 | 14134760 | K2ViewItem->display( ) | .../ViewController.php:102 |
14 | 0.5148 | 17201120 | K2ViewItem->display( ) | .../view.html.php:742 |
15 | 0.5148 | 17201120 | K2ViewItem->loadTemplate( ) | .../HtmlView.php:230 |
16 | 0.5177 | 17381320 | include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ) | .../HtmlView.php:701 |