HI i have done some AJAX, PHP&MySQL Sorting and it is giving me result in tables as shown in the code below, my question is how to bring that $result in html divs.
please help
PHP code used
<?php
$q=$_GET["q"];
$con = mysql_connect('localhost', 'root', '');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("security_software", $con);
$sql="SELECT * FROM internet_security ORDER by '".$q."' DESC" ;
$result = mysql_query($sql);
echo "<table border='1'>
<tr>
<th>id</th>
<th>title</th>
<th>image</th>
<th>description</th>
<th>rating</th>
<th>download</th>
<th>buy</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['title'] . "</td>";
echo "<td>" . $row['image'] . "</td>";
echo "<td>" . $row['description'] . "</td>";
echo "<td>" . $row['rating'] . "</td>";
echo "<td>" . $row['download'] . "</td>";
echo "<td>" . $row['buy'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
I want Result In These HTML Div’s
<div class="category-container">
<div class="category-image"></div>
<div class="category-link"><a href="#">#</a></div>
<div class="category-desc"><p>#</p> </div>
<div class="rating5" >Editors' rating: </div>
<div class="category-download-btn"><a href="#">Download </a></div><
<div class="category-buy-btn"><a href="#">Buy</a></div>
</div>
I’m inclined to view this as a bit of a joke, seeing as the database is called “security_software”, and you’re putting a GET var directly into a database query without doing any sanitation. You’re also making no attempt to clean anything coming from the database before spitting it back onto the page…
Anyway, assuming it’s not a joke, the following should point you in the right direction: