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]

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.