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

  • Home
  • SEARCH
  • 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 8961167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:49:27+00:00 2026-06-15T15:49:27+00:00

I am using wamp server on windows. while getting a little bit of data

  • 0

I am using wamp server on windows. while getting a little bit of data from my database hangs my page badly. it’s just like a simple post which have 1 image 1 title and a little bit discription and when I trigger the command it hangs my page badly. here is how my code looks like.

    <?php
    //1. Create a connection
    $connection= mysql_connect("localhost","root","");
    if(!$connection){
        die("Database Connection Failed :" . mysql_error());
    }

    //2 Select a database to use
    $db_select = mysql_select_db("gat", $connection);
    if (!$db_select) {
        die("Database selection failed: " . mysql_error());
    }

    ?>
<html>
<head>
    <title>Database Check</title>
</head>
<body>
    <?php 
        //3 perform database query
        $result=mysql_query("SELECT * FROM recent_works",$connection);
        if (!$result) {
            die("Database query failed:" . mysql_error());
        }

        //4 use returned data 
        while ($row= mysql_fetch_assoc($result)) {  
            echo "<div class='work_item'>";
            echo "<img src='{$row['image']}' alt=''>";
            echo "<h2>{$row['title']}</h2>";
            echo "<p>{$row['short_discription']}</p>";
            echo "</div>";
        }
     ?>
</body>
</html>
<?php 
    //5 close connection
    mysql_close($connection);
 ?>
  • 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-15T15:49:29+00:00Added an answer on June 15, 2026 at 3:49 pm

    Fetching data from a database will always involve some level of blocking. The question is how much data are you fetching. Your example indicates you are selecting everything from the table and fetching all of the data to print out onto the page. So how many rows are in the table, how much data is stored in each column, and how much of that data gets transferred to the client are all provisioning factors of speed here. Additionally, you have to consider that connecting to the database also has a cost.

    Here are a few suggestions I can make to the above code:

    1. Don’t use the old mysql extension (mysql_* functions), but consider using the newer MySQLi extension, which can help you do things the old extension can’t; like asynchronous queries. It’s also highly discouraged to use the old mysql extension in new development, since it’s in plans for deprecation currently. See MySQL: choosing an API in the PHP manual for more information.
    2. Check phpinfo() to make sure you aren’t using output buffering (which requires buffering up to a certain amount of data before it gets sent to the client). This could result in the client waiting around until there’s data ready to be sent. Pushing some HTML content out to the client as soon as possible could help improve the user experience.
    3. Don’t use SELECT * FROM table in your queries, instead, consider explicitly selecting only the fields you need for each query: SELECT image,title,short_discription FROM recent_works
    4. If there’s a lot of data (more than say hundred rows maybe) consider using pagination and LIMIT the query to a certain number of rows per page view. This can greatly reduce the amount of traffic between your DBMs and PHP on a per request basis.
    5. If it’s a high load site consider using a persistent database connection.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using wamp server 2.0 on Windows XP. Whenever I create a table
I have installed PHP using wamp server in Windows and I have give the
I am using WAMP for my Local Server in Windows 7. I want to
Im using Windows 7, and there I installed apache server in c:\wamp\apache\ , PHP
I want to bake cake php project on Windows system. I'm using wamp server
I'm using the wamp package(Apache server) in my windows xp. After i followed the
I have installed wamp server 2.2 I'm using windows 7 When I am online
Here's the basic information: I'm using WAMP on Windows 8 64 bit. Apache 2.4.2,
Hi I'm new to php mysql development. I'm using wamp server on windows. php5.3.4,
I am using WAMP server on windows 7 and zend framework 2. I used

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.