PHP-----Multi-Criteria Query

Source: Internet
Author: User

In the development of web pages, with Google and Firefox browser, it will be better. IE browser is not too easy to use.

Multi-Criteria Query

Take the car watch cars, for example.

First find out the car table, using the form to display, in addition to some query conditions in.

The first step: to find out the car table, using a table to display

<table width= "100%" border= "1" cellpadding= "0" cellspacing= "0" >

<tr>

<td> Code </td>

<td> name </td>

<td> Series </td>

<td> Time to Market </td>

<td> Fuel Consumption </td>

<td> Power </td>

</tr>

<!--each row shown, each column is read by the database--

<!--querying the database, so referencing the class file--

<?php

Include ("DBDA.class.php");//reference class file

$DX =new Dbda ();//Build Object

Write SQL statements, query statements

$sql = "SELECT * from Car";

Call the Query method to invoke the SQL statement and return a two-dimensional array after execution $attr

The returned two-dimensional array contains all the information in the car's table.

$attr = $dx->query ($sql);

Next, the car's information, displayed, with a table to display,

With a single table, each row is a piece of data, so a two-dimensional array is recycled

foreach ($attr as $v)//loop out each piece of data

Here you can build each line of <tr>

{

echo "<tr>

<td>{$v [0]}</td>

<td>{$str}</td>

<td>{$v [2]}</td>

<td>{$v [3]}</td>

<td>{$v [4]}</td>

<td>{$v [5]}</td>

</tr> ";

}

Loop two-dimensional array, the $v, $v variable It contains a one-dimensional array, and a one-dimensional array of each data stored in the specific value.

?>

</table>

PHP-----Multi-Criteria Query

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.