Php page is loading slow

  • LuckyL
  • Born
  • Born
  • LuckyL
  • Posts: 3

Post 3+ Months Ago

Hi all!
I have a recently php website (it was in HTML and I am transforming it, to be able to insert mysql code intro the pages).
The first page was loading very fast, no problems and I had on it:
- 2 javascript scripts
- 2 counter scripts
- an acces to the databse to get a random quote
Now I added a 'Latest News' facility, with acces to the database too and the page is loading very slow, comparerly to the previous version.
Can you help me please with this matter?
The addry: http://www.harrypotter.as.ro/index.php
The mysql code are used in:
'Citatul momentului' (random quote)
and
the recently one:
'Ultimile stiri' (latest news) --> the one that started the problems
Thanx all!
  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

Well, without seeing the actual code you're using to make your database queries, it's kinda impossible to say :)
  • LuckyL
  • Born
  • Born
  • LuckyL
  • Posts: 3

Post 3+ Months Ago

Well, the code looks like this:

$interogare = "SELECT textt, idt FROM tname order by idt DESC LIMIT 0, 3";

$rezultat = mysql_query($interogare);
if (mysql_errno())
{
die("<BR>" . mysql_errno().":".mysql_error()."<BR>");
}

while ($rand = mysql_fetch_row($rezultat))
{

$textt = $rand[0];
$idt = $rand[1];
echo("$textt");
echo("<br>--------------<br>Introdusa de: ");
}
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Posts: 401
  • Loc: Scorpion Hole

Post 3+ Months Ago

Well, I don't think it is the code, I'm thinking it is the MySQL database you are trying to get it from. If that is a large server that has many sites hosted on it, the MySQL databases may be getting access a lotand slowing down some.
On some very large sites that are mainly just forums, the pages will take a while to load, because of so many MySQL commands.
This may be your problem, or might not be, nobody knows.
  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

Yeah, that code does look fairly simple and should load quick..

Like Scorpius suggests, it could simply be that the MySQL server is under a heavy load.

You might want to check with your host and see what they say.
  • LuckyL
  • Born
  • Born
  • LuckyL
  • Posts: 3

Post 3+ Months Ago

Thanx for the answers. I think u r right. Today, the same page is loading faster, without my intervention.
  • stinger
  • Graduate
  • Graduate
  • stinger
  • Posts: 157
  • Loc: San Jose, CA

Post 3+ Months Ago

You might want to try using a simple text file for your quotes. Especially if the information is not private.

Just my 2 sense. This will load relatively fast in php.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 46 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.