如何以适当格式html从数据库中检索数据

I have product table in database. there are few categories such as product title, description, feature etc

For Example, i want to display $obj_p->description in list form like

SKU: B00YO9QCSW 5th Generation Processor !!

Intel Core i5 5th Gen 2.2 / 2.7 Ghz Processor 13.3" QHD Screen

  1. Intel Integrated Graphics 4 GB RAM,
  2. 128 GB SSD No Optical Drive
  3. Webcam
  4. Bluetooth
  5. WiFi
  6. BackLit K/B
  7. Windows 8.1 Pro

Stored data of description appeared in database as below format!

SKU: B00YO9QCSW

5th Generation Processor !!

Intel Core i5 5th Gen 2.2 / 2.7 Ghz Processor,

13.3" QHD Screen, Intel Integrated Graphics,

4 GB RAM, 128 GB SSD, No Optical Drive,

Webcam, Bluetooth, WiFi, BackLit K/B, Windows 8.1 Pro

I have done code like this!

 <div class="span4">
   <div class="product">
       <div class="product-image full-width">
       <a href="<?php echo(BASE_URL); ?>products/product_detail.php?productID=<?php echo($obj_p->productID); ?>">
       <img src="<?php echo(BASE_URL); ?>products/catalog/<?php echo("$obj_p->product_name/$obj_p->product_image"); ?>" alt="<?php echo($obj_p->product_name); ?>" title="<?php echo($obj_p->product_name); ?>" /></a></div>
       <div class="view-count full-width"><?php echo($obj_p->view_count); ?> views</div>
       <div class="product-price full-width">$ <?php echo($obj_p->unit_price); ?></div>
       </div>  
   </div> 
 <div class="span4">   
   <label><?php echo($obj_p->product_name); ?></label>
    <div class="product-description"> <p> <?php echo($obj_p->description); ?></p></div>
    <div class="spacer11pxH full-width"></div>
 </div>

Here are Screenshots of table database and column.

Table preview column

Table preview

If I'm understanding your question correctly, you want to display data from your database in HTML text? If so...

Have you tried using AJAX to return the stored data from your database?

Your HTML would look something like this:

<body onLoad="getInformation()">
<div class="span4">
<div class="product">
<div class="product-image full-width">
<span id="productInformation"></span>
</div>
</div>
</div>
</body>

Your JavaScript would look something like this:

function getInformation(){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if (xhttp.readyState == 4 && xhttp.status == 200) {
     document.getElementById("productInformation").innerHTML = xhttp.responseText;
    }
}
var url = "http://yourPHPURL.com/getInformation.php";
xhttp.open("GET", url, true);
xhttp.send();
}

And finally your PHP / SQL code would look something like this:

<?php
$host = "localhost";
$user = "root";
$password = "";
//Connects to the database
$dbc = mysql_pconnect($host,$user, $password);

//Selects the database to use and opens it
$dbname = "DBname";
@mysql_select_db($dbname) OR die ('Cannot connect to database:'. mysql_error());

//Makes the required query to the database
$query = "SELECT * FROM database;";
$result = mysql_query($query);

//Returns the item searched for by the user to AJAX
while($row=mysql_fetch_array($result))
{ 
echo("Details:");
echo($row['product_name']);
echo(<br><br>);
echo($row['description']);
}
?>

Hopefully this is what you're looking for...