When doing PHP query database-How to solve

Source: Internet
Author: User
When you do a PHP query database---
In the PHP query database, I passed the parameter to get the ID of a table, how can I use this ID to display the table of a certain field value;

Can also understand this: there is a user table, the field inside the Id,user,time,title, I now know the user ID, I want to take out the user table inside the Time,title these two fields, the MySQL database query, how should write the statement?????

Our project manager did not realize for a long while, seek the master to solve


Php

Share to:


------Solution--------------------
SELECT time,title from User WHERE id= ' incoming ID value '
------Solution--------------------
$rs = mysql_query ("Select Time,title from User WHERE id= ' $id '");
$row = Mysql_fetch_assoc ($RS);
echo $row [' time '], ', $row [' Title '];
------Solution--------------------

The MYSQL_FETCH_ASSOC () function obtains a row from the result set as an associative array.

Returns an associative array based on the rows obtained from the result set, or False if there are no more rows.

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