PHP query function (how to get the fields of the corresponding table by query criteria)

Source: Internet
Author: User
PHP query function (how to get the fields of the corresponding table through the query criteria)
 Get Connected
$db = mysql_connect ("localhost", "root", "root") or Die (Mysql_error ());
echo "Connected to MySQL
";
Connecting to a database
mysql_select_db ("test") or Die (Mysql_error ());
echo "Connected to Database";

Query the data and display it in a table
@ $checked = $_post[' checked ');
@ $result = mysql_query ("SELECT * from Books", $db);
echo "















\ n "; echo " "; echo " \ n "; Loop through while ($myrow = Mysql_fetch_row ($result)) { printf (" ", $myrow [0], $myrow [1], $myrow [2], $myrow [3]); } echo "
Isbn Author Title Price
%s %s %s %s
\ n ";
?>



<title>Untitled Document</title>





------Solution--------------------
result = mysql_query ("SELECT * from books where checked= ' $checked '");
------Solution--------------------
if (isset ($_post[' checked ')) {
@ $result = mysql_query ("SELECT * from Books", $db);
echo "







  • \ n "; echo " "; echo " \ n "; Looping through
    Isbn Author Title Price

    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.