Jump to content

Recommended Posts

Hiya ..

 

Hopefully just a quick question ..

 

my new homepage ... www.bradleystokejudoclub.co.uk/newindex.php

is loading incredibly slow, and I figure it is because of the query that is in the Latest News section ...

 

Is there a way to load the rest of the page and not have to wait for the query ... maybe some kind of "loading" in the latest news bit whilst its getting there??

 

Hope that makes sense...

 

thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/149186-query-making-my-page-slow-help/
Share on other sites

Sure ...

 

<?php
$con = mysql_connect(" =) ");
if (!$con)
{
    die('Could not connect: ' . mysql_error());
}
mysql_select_db("bssql", $con);
$result = mysql_query("SELECT `title`, `subtitle` FROM `articles` ORDER BY `ID` DESC LIMIT 5") or die(mysql_error());
while($row = mysql_fetch_assoc($result))
{
    ?><b><?php echo $row['title'];?></b> 
    <BR><?php echo $row['subtitle']?><BR><?php
}
mysql_close($con);
?>

gemmerz, if you want the page to display and don't mind the delay for the last part, may i suggest using flush()

 

ie

<?php
echo "Start of the page..<br>";
flush();
sleep(2); //delays
echo "Rest of the page";
?>

 

as for your mysql connection, i assume your using localhost!

 

you say you figure it because of the sql.. but is this a guess or have you tried removing it to see if it speeds up ?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.