如何从变量获取mysql查询传递值

时间:2014-09-03 17:57:46

标签: php mysql fetch

如何从变量获取mysql查询传递值  并且它没有从变量传递值

here is my table structure 

question

---------------------------------------
id    qry                     name
---------------------------------------
1    select sal,price from     rai
     where id =$totno


2   select sal,price from      sri
    where id =$totno
-------------------------------------

这是我的编码部分

    $totno=$_REQUEST['tno'];
    $fno=$_REQUEST['sno'];
    $fetqu=mysql_query(select * from testtmp where id='$fno');
    while($rec=mysql_fetch_array($fetqu))
    {
     $qu=$rec['qry'];
    }
    echo $qu;

    $tfet=mysql_query($qu);
    while($rec=mysql_fetch_array($tfet))
    {
     $sal=$rec['sal'];
     $price=$rec['price'];
    }

这里没有从varible传递值我得到的错误就像

输出:

选择sal,其中id = $ totno的价格警告:mysql_fetch_row()期望参数1为资源,第11行的C:\ xampp \ htdocs \ rpt_pdf \ test.php中给出布尔值

0 个答案:

没有答案
相关问题