Jump to content

[SOLVED] Queries doen't appear until I refresh the page


theblokgroup

Recommended Posts

I am entirely baffled by this problem.  I have created a basic php script that queries a mysql database and

displays the information using a while loop.

 

Sometimes, when a user visits the website page, none of the queries show

up but once you refresh the page, they appear.

 

I have modified max_connections in my.cnf, that is not the problem.  I

have also tried recoding it, that didn't help.  Any suggestions would be

great!

 

I have also turned on all errors in PHP and there are no errors showing up.

 

Specs: Dedicated Fedora Server, Plesk Control Panel, 4GB RAM, 16-GB Storage, MySQL 5.0.45, PHP 5.2.6

 

 

Here is the connection string and code (there is also an attached image that displays what is happening - notice recent jobs, blogs and events are blank):

 

<?php $connection = mysql_pconnect('', '', '', $new_link= true) or die('MySQL Connection Error: The Connection String Malfunctioned.');

mysql_select_db('') or die ('MySQL Connection Error: Cannot connect to the DB: '.mysql_error() ); ?>

 

<?php

$sqlrecc = mysql_query("SELECT * FROM events WHERE active = '1' AND home =

'1' ORDER BY first_date ASC LIMIT 5");

while($rowrecc = mysql_fetch_assoc($sqlrecc))

{

echo "<p><a

href=\"viewevent.php?id=".$rowrecc['id']."\">".ucwords($rowrecc['event_name'])."

»</a><br />";

echo

ucwords($rowrecc['event_date'])."<br/>".ucwords($rowrecc['location'])."</p>";

}

?>

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

Can you post the script rather than that snippet at the top? I think this  is more PHP-related than it is MySQL-related.

We frown upon posting entire scripts... that's never the answer.  And if it's php-related, then it doesn't belong on this board.

Link to comment
Share on other sites

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.