Questions about the array after three-table check ~

Source: Internet
Author: User
Three table after check ~ ~ ~ The problem of the array ~ ~
A bit long ~ ~ First thanks to read and reply to the friend ~ ~ ~ ~ straight into the topic

Mission_need table is the task table, the primary key misneed_id
The Offer_need table is the spot table, the primary key offneed_id, the task ID field misneed_id, and the User ID field that publishes the bid Offneed_user
UserInfo table is the User Information table, the primary key user_id

Example:
Now it's time to take out the task information under this task of misneed_id=5 + all bids under this task + the user information for each auction

The SQL I wrote is the following ~ ~ ~

SELECT *
From Mission_need
Left JOIN offer_need on mission_need.misneed_id = Offer_need.offneed_misid
JOIN userinfo on offer_need.offneed_user = userinfo.user_id where mission_need.misneed_id=5

The post section code is as follows
 
  Require (' config.php ');
Require (' conn.php ');

$misneed _id=$_get[' id '];

From Mission_need
Left JOIN offer_need on mission_need.misneed_id = Offer_need.offneed_misid
JOIN userinfo on offer_need.offneed_user = userinfo.user_id where mission_need.misneed_id= ' $misneed _id ' ";
$query =mysql_query ($sql);
$result =mysql_fetch_array ($query);
Print_r ($result);

$smarty->display (' need_view.html ');

?>


My database is normally taken out of two lines of records ...


But that's what I print out of the array.
Array ([0] = 1 [misneed_id] = 1 [1] = = Test [Misneed_title] = Test [2] = = Test [Misneed_text] = tes t [3] = 5 [Misneed_user] = 5 [4] = 4444 [Misneed_price] = 4444 [5] = 0 [Misneed_status] = 0 [6] =& Gt 0 [Misneed_moneystatus] = 0 [7] = 20130119170332 [Misneed_time] = 20130119170332 [8] = = 20130102122522 [mis Need_deadline] = 20130102122522 [9] = 1 [Misneed_classid] = 1 [ten] = =/upload_file/5/130119050132.jpg [mis Need_file] =/upload_file/5/130119050132.jpg [one] = 1 [offneed_id] = 1 [] = offer test [offneed_text] = > Offer test [20130120211950] [offneed_price] [+] = [] = 20130120211950 [Offneed_time] + [15] + 3 [Offneed_round] + 3 [+] = 0 [offneed_status] + 0 [+] = 5 [Offneed_user] = 5 [+] = 1 [of FNEED_MISID] [1] = 5 [user_id] = 5 [] = Pingtai [user_name] = Pingtai [+] = 03142410d7285f 00e4363e005783c83a [USER_PWD] = 03142410d7285f00e4363e005783c83a [1] [User_power] = 1 [] = 555@qq.com [User_email] =&gt ; 555@qq.com [[] = 2147483647 [User_phone] + 2147483647)

It's obviously just one of those records.


------Solution--------------------
Perform a $result =mysql_fetch_array ($query);
Read Only one record
------Solution--------------------
Require (' config.php ');
Require (' conn.php ');

$misneed _id=$_get[' id '];

From Mission_need
Left JOIN offer_need on mission_need.misneed_id = Offer_need.offneed_misid
  • 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.