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.0003 | 414296 | {main}( ) | .../index.php:0 |
2 | 0.0866 | 4264760 | Joomla\CMS\Application\SiteApplication->execute( ) | .../index.php:49 |
3 | 0.0866 | 4264760 | Joomla\CMS\Application\SiteApplication->doExecute( ) | .../CMSApplication.php:196 |
4 | 0.2958 | 11455792 | Joomla\CMS\Application\SiteApplication->dispatch( ) | .../SiteApplication.php:233 |
5 | 0.2966 | 11480056 | Joomla\CMS\Component\ComponentHelper::renderComponent( ) | .../SiteApplication.php:194 |
6 | 0.2974 | 11535384 | Joomla\CMS\Component\ComponentHelper::executeComponent( ) | .../ComponentHelper.php:377 |
7 | 0.2977 | 11562784 | require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ) | .../ComponentHelper.php:402 |
8 | 0.3065 | 11962416 | K2ControllerItem->execute( ) | .../k2.php:64 |
9 | 0.3065 | 11962416 | K2ControllerItem->display( ) | .../BaseController.php:710 |
10 | 0.3182 | 12613120 | K2ControllerItem->display( ) | .../item.php:78 |
11 | 0.3182 | 12613120 | K2ControllerItem->display( ) | .../controller.php:19 |
12 | 0.3225 | 12984160 | Joomla\CMS\Cache\Controller\ViewController->get( ) | .../BaseController.php:663 |
13 | 0.3238 | 13004528 | K2ViewItem->display( ) | .../ViewController.php:102 |
14 | 0.4120 | 15929296 | K2ViewItem->display( ) | .../view.html.php:742 |
15 | 0.4120 | 15929296 | K2ViewItem->loadTemplate( ) | .../HtmlView.php:230 |
16 | 0.4141 | 16102232 | 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.0003 | 414296 | {main}( ) | .../index.php:0 |
2 | 0.0866 | 4264760 | Joomla\CMS\Application\SiteApplication->execute( ) | .../index.php:49 |
3 | 0.0866 | 4264760 | Joomla\CMS\Application\SiteApplication->doExecute( ) | .../CMSApplication.php:196 |
4 | 0.2958 | 11455792 | Joomla\CMS\Application\SiteApplication->dispatch( ) | .../SiteApplication.php:233 |
5 | 0.2966 | 11480056 | Joomla\CMS\Component\ComponentHelper::renderComponent( ) | .../SiteApplication.php:194 |
6 | 0.2974 | 11535384 | Joomla\CMS\Component\ComponentHelper::executeComponent( ) | .../ComponentHelper.php:377 |
7 | 0.2977 | 11562784 | require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ) | .../ComponentHelper.php:402 |
8 | 0.3065 | 11962416 | K2ControllerItem->execute( ) | .../k2.php:64 |
9 | 0.3065 | 11962416 | K2ControllerItem->display( ) | .../BaseController.php:710 |
10 | 0.3182 | 12613120 | K2ControllerItem->display( ) | .../item.php:78 |
11 | 0.3182 | 12613120 | K2ControllerItem->display( ) | .../controller.php:19 |
12 | 0.3225 | 12984160 | Joomla\CMS\Cache\Controller\ViewController->get( ) | .../BaseController.php:663 |
13 | 0.3238 | 13004528 | K2ViewItem->display( ) | .../ViewController.php:102 |
14 | 0.4120 | 15929296 | K2ViewItem->display( ) | .../view.html.php:742 |
15 | 0.4120 | 15929296 | K2ViewItem->loadTemplate( ) | .../HtmlView.php:230 |
16 | 0.4141 | 16102232 | include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ) | .../HtmlView.php:701 |