PHP read database table display to foreground

Source: Internet
Author: User

<?php
$username =$_get[' uid ']; Get a value as a query condition


$result = $db->query ("SELECT * from-trip where author= '". $username. "");
$num _cats= $result->num_rows; Whether there is a return row
if ($num _cats==0)//If NULL is not shown
echo "<div class=\" empty\ "></div>
<div class=\ "cb\" ></div> ";

$res _array=array (); Define an array
for ($count =0; $row = $result->fetch_assoc (); $count + +) {//The results returned by the database are stored in an array set
$res _array[$count]= $row;
}

if (count ($res _array) >0) {
echo "<ul>
<li style= ' text-align:center;width:100px;float:left; ' ><a> Topics </a></li>
<li style= ' text-align:center;width:100px;float:left; ' ><a> dates </a></li>
<li style= ' text-align:center;width:100px;float:left; ' ><a> author </a></li>
<li style= ' text-align:center;width:150px;float:left; ' ><a> Browse </a></li> </ul><br>
<ul> ";

foreach ($res _array as $rows) {//Loop output array value
echo "<br><li style= ' text-align:center;width:100px;float:left; ' > ". $rows [' title ']. "</li>
<li style= ' text-align:center;width:100px;float:left; ' > ". $rows [' Time ']. "</li>
<li style= ' text-align:center;width:100px;float:left; ' > ". $rows [' Author ']. "</li>
<li style= ' text-align:center;width:100px;float:left; ' > ". $rows [' Scan ']. "</li>";
}
echo "</ul>";
}
?>

PHP read database table display to foreground

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.