佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 2285|回复: 2

sql statement

[复制链接]
发表于 28-8-2006 02:19 PM | 显示全部楼层 |阅读模式
Below is my coding and error message

--------------------------------------------------------------------------
1.php

<?php
    mysql_connect("localhost","root","1234");
    mysql_select_db("spm");
   
    $aa="select * from bookorder";
    $bb=mysql_query($aa);
   
    echo "<table width=75% border=1>";
    echo"<tr><td>Name<td>ID<td>Contact No<td>Delivery Address<td>Order Time<td>Cartid</tr>";
    while(list($a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7)=mysql_fetch_row($bb))
    {
            echo"<tr>
                     <td>$a1</td>
                     <td>$a2</td>
                     <td>$a3</td>
                     <td>$a4</td>
                     <td>$a6</td>
                     <td><a href=detail1.php?pk=$a7>$a7</a></td>
                     </tr>
                    ";
    }
    echo "</table>";
    ?>
--------------------------------------------------------------------------


请问要如何改这段sql statement? so when i click the value of cartid column
it can come up the detail transaction of that particular value..


this is the error message

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\program files\easyphp1-7\www\spm_projects\transaction\detail1.php on line 16

--------------------------------------------------------------------------
detail1.php

<?php
   
    mysql_connect("localhost","root","1234");
    mysql_select_db("spm");
   
  
    $pk = $_GET['pk'];
   
    $aa="select putbag.cartid,sum(putbag.amt),sum(bookorder.price * putbag.amt)
            from book, putbag
            where putbag.psn=book.psn
            group by putbag.cartid";
   
   
    $bb=mysql_query($aa);
   
    list($a0,$a1,$a2)=mysql_fetch_row($bb);

    echo"<table width=100% border=1>";
    echo"<tr>
             <td>Cartid<td>$a0</tr>
             <tr><td>Total Quantity<td>$a1</tr>
             <tr><td>Total Amount (RM)<td>$a2</tr>
             ";
    echo"</table>";
              
   ?>
--------------------------------------------------------------------------
thanks.......

[ 本帖最后由 html 于 28-8-2006 05:00 PM 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

发表于 28-8-2006 03:59 PM | 显示全部楼层
what was the error coming out?seens like ok only
回复

使用道具 举报

 楼主| 发表于 28-8-2006 11:24 PM | 显示全部楼层
原帖由 8years 于 28-8-2006 03:59 PM 发表
what was the error coming out?seens like ok only


i solve the probelm edi.. just change it like below

$aa="select putbag.cartid,sum(putbag.amt),sum(book.price * putbag.amt)
            from book, putbag
            where putbag.psn=book.psn and putbag.cartid='".$pk."'
            group by putbag.cartid";
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 23-9-2024 01:22 PM , Processed in 0.107623 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表