Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7953647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:12:26+00:00 2026-06-04T03:12:26+00:00

HI i have done some AJAX , PHP&MySQL Sorting and it is giving me

  • 0

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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:12:28+00:00Added an answer on June 4, 2026 at 3:12 am

    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:

    <?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);
    
    while($row = mysql_fetch_array($result)) {
        echo '<div class="category-image"><img src="' $row['image'] . '</div>';
        echo '<div class="category-link"><a href="#">' . $row['title'] . '</a></div>';
        echo '<div class="category-desc"><p>' . $row['description'] . '</p></div>';        
        echo '<div class="rating5" >Editors' rating: ' . $row['rating'] . '</div>';       
        echo '<div class="category-download-btn"><a href="' . $row['download'] .'">Download</a></div>';
        echo '<div class="category-buy-btn"><a href="' . $row['buy'] . '">Buy</a></div>';
     }
    echo "</table>";
    
    mysql_close($con);
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two MySQL tables named 'nodes' and 'joinTable' like shown below. I need
i have done some code in jquery but where i commented in this bellow
I have some jquery ajax code to update a record but it's not working
I'm trying incorporate some if-else statements with ajax So basically I have this php
Have done some research and found some stuff that may be helpful. I would
I have done some looking and I found this: http://www.codeproject.com/Articles/14439/The-ScrollableListBox-Custom-Control-for-ASP-NET-2 but to me it
I have done some commits and pushed them into my repository. Then I did
I have done some research and it really seems that implementing a transaction system
I have done some digging out here and am still a little unsure how
I have done some project in Irrlicht and it compiles all well, however when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.