How does PHP find information on the same row in another database according to the specified information

Source: Internet
Author: User
Tags php foreach
How PHP finds information in the same row in another database according to the specified information.
The database has been built TB_XMPC, only two columns, one column is xmpc_id, one column is xmpc_expr, now I want to follow the xmpc_id information extracted from the Web page to get the corresponding xmpc_expr column information, set as the default option, I do not know why always can not display the query results, To the heroes of the road to ask!

The corresponding code is as follows:
Find the batch description corresponding to the batch ID
$query 2=mssql_query ("select * from TB_XMPC where xm_pcid= ' $xmpc _id '");
$myrow 2=mssql_fetch_array ($query 2);
$old _pc= $myrow 2[xmpc_expr];
?>

Share to:


------Solution--------------------
How are you going to output the array?

$query 2=mssql_query ("select * from TB_XMPC where xm_pcid= ' $xmpc _id '");
$temp =array ();
while ($myrow 2=mssql_fetch_array ($query 2)) {
Array_push ($temp, $myrow 2[' XMPC_ECPR ');
}




------Solution--------------------
$old _pc not a single value?
Change to this:

------Solution--------------------
Do you need a query two times?
Change it to the following:
!--? php  $query 2=mssql_que                           Ry ("SELECT * from TB_XMPC"); while ($myrow 2=mssql_fetch_array ($query 2)) {$selected = $myrow 2[xmpc_id]== $xmpc _id?       ' selected= ' selected "': '; ?> >!--? php echo $myrow 2[xmpc_e XPR];? --> !--? php   

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.