PHP read two data sheet problems

Source: Internet
Author: User
I use a program it puts the ID of the recommended content in a recommendation table I want to call a recommended type of content can not be adjusted, please expert guidance.
$result =mysql_query ("SELECT * from ' recommendation table ' where tj_id=1 limit 0,12");
while ($row =mysql_fetch_array ($result)) {
?>
$aid = $row [tj_id];
$result 1=mysql_query ("select * from" Content table ' where Id=aid ');//where id=aid here to the aid directly to the number can come out, should be the last line to get results
while ($row =mysql_fetch_array ($result 1)) {
?>


}
?>
}
?>


Reply to discussion (solution)

Print_r ($row); Look
$aid = $row [tj_id];

If the "previous row does not get results", then there is no execution at all

$aid  = $row [tj_id];=> $aid = $row [' th_id '] if the value is not reached, then you look closely.

$aid = $row [tj_id];
$result 1=mysql_query ("select * from ' content table ' where id=1");//That is to say, this outputs
while ($row =mysql_fetch_array ($result 1)) {
?>

$aid = $row [tj_id];
$result 1=mysql_query ("select * from" Content table ' where Id=aid ");//landlord here should be replaced by the aid $aid it? Do you mean to check the id= string for aid?

Aid changed to $aid, you're a variable, not a character.

  • 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.