How to use PHP to save data read from a database in a re-variable

Source: Internet
Author: User
How do I use PHP to save data from a database to be read in a re-variable?
Use echo $myrow 1[xm_name]; You can export the project name, use Echo $myrow 2[ZF]; You can get the total score of the project, but how do you save it in a variable in PHP? $XM _name= $myrow 1[xm_name]; $xm_zf= $myrow 2[ZF]; the variable echo in the two sentences has no result.
$query 1=mssql_query ("select * from TB_XM where xm_pcid= ' $xmpc _id '");
while ($myrow 1=mssql_fetch_assoc ($query 1)) {
echo $myrow 1[xm_name];
$XM _name= $myrow 1[xm_name];/***************/
$query 2=mssql_query ("Select sum (XMPF_SMALL_ZF) as ZF from Tb_xmpf where xmpf_xm= ' $myrow 1[xm_name] ');
echo $query 2;
echo "Total score:";
while ($myrow 2=mssql_fetch_assoc ($query 2)) {
echo $myrow 2[ZF];
$XM _zf= $myrow 2[ZF];
}

Share to:


------Solution--------------------
$XM _name = $myrow 1["Xm_name";

$query 3=mssql_query ("Update tb_xm set xm_zf= ' $myrow 2[zf] ' where xm_name= ' $xm _name '");
------Solution--------------------
Your ending semicolon is full-width, and you can change it to half-width.
$query 3=mssql_query ("Update tb_xm set xm_zf= ' $myrow 2[zf] ' where xm_name= ' $myrow 1[xm_name] ');
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.