数据列表写好了(好费劲):http://weixiao.de/d/list.php现在还是搜索页面整个不会写,求搜索页面源码。List.php源码如下:
<?php
include("config.php"); 
include("header.html"); 
?><table width=800 border=0 cellspacing=0 cellpadding=0 align=center>  
 <tr>   
  <td><font color=#0772b1 class=mid>      
 <b>捐赠信息列表</b> 
</font> 
 </td>
<tr>   
 <td colspan=2><hr size=1></td>  
 </tr></table> 
<table width=800 border=0  cellpadding=8 align=center>   
<tr>  
 <td align=center width=8% bgcolor=#dedede>编号</td>    
 <td align=center width=12% bgcolor=#dedede>捐赠者</td>
 <td align=center width=14% bgcolor=#dedede>所在单位</td>
 <td align=center width=8% bgcolor=#dedede>日期</td>
 <td align=center width=8% bgcolor=#dedede>金额</td>
 <td align=center width=20% bgcolor=#dedede>物资</td>
 <td align=center width=16% bgcolor=#dedede>用途</td>
 <td align=center width=12% bgcolor=#dedede>备注</td>
</tr><?php
$result=mysql_query("select * FROM normal");   
while($array=mysql_fetch_array($result)){ //判断是否到达数据库的结尾 
echo"<tr> 
<td class=mid align=center width=8%>$array[id]</td> 
<td class=mid align=center width=12%>$array[name]</td> 
<td class=mid align=center width=14%>$array[danwei]</td>
<td class=mid align=center width=8%>$array[date]</td> 
<td class=mid align=center width=8%>$array[cash]</td>
<td class=mid align=center width=20%>$array[other]</td>
<td class=mid align=center width=20%>$array[use]</td>  
<td class=mid align=center width=17%>$array[t]</td> 
</tr>"; 
$num+=$array[cash];

echo "<tr><td colspan='8' align='right' bgcolor=#dedede>合计金额$num 元,物资详单如上<br></td></tr>";?></table>
求一个搜索页面和搜索后的数据返回页面。昨天有个高手给提醒了一句,但写了半天全部失败,表示丢人======================================
另,数据录入页面源码,根据网上的写,永远出错,求纠正。
源码如下:<?php
include("config.php");
$id = $_POST['id'];
&name = $_POST['name'];
$danwei = $_POST['danwei'];
$date = $_POST['date'];
$cash = $_POST['cash'];
$other = $_POST['other'];
$use = $_POST['use'];
$t = $_POST['t'];
$sql="insert into normal('id','name','danwei','date','cash','other,'use','t') values('{$id}','{$name}','{$danwei}','{$date}','{$cash}','{$other}','{$use}','{$t}')";
echo("$sql");
mysql_query("$sql");
?>
谢谢各位了!

解决方案 »

  1.   

    本人PHP白痴,请求各位不要光给一个PHP语句、不会套用的说……
      

  2.   

    mysql是否已连接?
    echo $sql 到phpmyadmin中执行一下看看是否成功.
    还是找一个数据库操作类吧
      

  3.   

    $result=mysql_query("select * FROM normal");   
    while($array=mysql_fetch_array($result)){}mysql_query这个你用错了吧?它返回一个标识符而已,怎么能充当一个结果集用到mysql_fetch_array这个里边呢?
    还有提问的时候最好把报错语句展示出来,要不从哪儿下手给你支招呀……
      

  4.   

    错误提示:Parse error : syntax error, unexpected '&' in /home/jiujiuwo/domains/weixiao.de/public_html/d/add_1_do.php on line 4
    地址:weixiao.de/d/add_1.PHP
      

  5.   


    <?php
    include("config.php");
    $id = $_POST['id'];
    $name = $_POST['name'];
    $danwei = $_POST['danwei'];
    $date = $_POST['date'];
    $cash = $_POST['cash'];
    $other = $_POST['other'];
    $use = $_POST['use'];
    $t = $_POST['t'];
    $sql="insert into normal(id,name,danwei,date,cash,other,use,t) values('{$id}','{$name}','{$danwei}','{$date}','{$cash}','{$other}','{$use}','{$t}')";
    echo $sql;
    mysql_query($sql);
    ?>
      

  6.   


    //把这一段放在你的表格上面:
    <p>
    <form action="" method="post">
    请输入查询关键字:<input type="text" name="key">
    <input type="submit" name="submit" value="搜索">
    </form>
    </p>//查询代码如下:
    $where = (!empty($_POST['key'])) ? "where id like '%" . $_POST['key']."%' or name like '%".$_POST['key']."%' or date like '%".$_POST['key']."%'" : '';
    $result=mysql_query("select * FROM normal".$where); 
    .......加上你下面的代码