Jump to content

Recommended Posts

This is going to be difficult explain.....

I have a website and on the main page there is a link to the forum i've made. Click the forum link and the main forum page comes up in a new page showing the discussion topic(s), the author, number of replies and the last post.

However, if you view certain pages on the main site and then go back to the main page and click the forum link the forum layout comes up but the discussion topic(s), the author, number of replies and the last post don't come up.  I have to close both windows, open my website again, click the forum link again and the discussion topic(s), the author, number of replies and the last post are back again. Weird!

Maybe it's just my computer. Could a few people try it, see if the same thing happens? Would be much appreciated.

Go to www.elvis-people.com

click the forum link.  One discussion should be there - Forum guidelines.

Now close the forum window.

On the main page click on  How to view photos. Click on Newest members first  or  Oldest members first. click go.

Then click again on How to view photos, click randomly and click go

Click the forum link.

Does the discussion topic, replies, etc come up?

 

Link to comment
https://forums.phpfreaks.com/topic/74191-a-very-weird-thing/
Share on other sites

Thanks.

This is the part of the code on the forum's main page where the problem is occurring.

mysql_select_db($database_elvisdb, $elvisdb);
$query_Recordset3 = "SELECT * FROM discussions";
$Recordset3 = mysql_query($query_Recordset3, $elvisdb) or die(mysql_error());
$result = mysql_query($query_Recordset3);
$t = time();
// loop for putting times of latest posts of each discussion into array.
while ($row_Recordset3 = mysql_fetch_assoc($result)) 
{
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$topicnum[$acount] = $row_Recordset3['discnum'];
// if discussion is announcement or sticky then increase time so it always stays on top in discussion list
if ($row_Recordset3['sticky']=="sticky" or $row_Recordset3['anounc']=="announcement") {
if ($row_Recordset3['anounc']=="announcement") {
($t=$t+10);
} else {
($t=$t+1);
}
$oldt = $row_Recordset3['time'];
$order[$acount] = $t;
$dnam = $topicnum[$acount];
$updateSQL = sprintf("UPDATE discussions SET time='$t' WHERE discnum='$dnam'");
  mysql_select_db($database_elvisdb, $elvisdb);
  $Result1 = mysql_query($updateSQL, $elvisdb) or die(mysql_error());

  $updateSQL = sprintf("UPDATE forum SET timenum='$t' WHERE timenum='$oldt'");
  mysql_select_db($database_elvisdb, $elvisdb);
  $Result1 = mysql_query($updateSQL, $elvisdb) or die(mysql_error());

} else {
$order[$acount] = $row_Recordset3['time'];
}
($acount=$acount+1);

$totalRows_Recordset3 = mysql_num_rows($Recordset3);
}
$total = $totalRows_Recordset3;
if ($acount >= 2) {
rsort ($order);
}
print_r ($order);

 

There is only one discussion on the forum at the moment.

When the problem occurs what is storred in the 'order' array is this-

1andom 

What  does this mean?

Link to comment
https://forums.phpfreaks.com/topic/74191-a-very-weird-thing/#findComment-375349
Share on other sites

Thanks.

I've searched all code and no 'andom' was found.

 

An Unix timestamp should be stored in the array so why should '1andom' be put in there instead. It should be reading whats stored in the database field and that is an Unix timestamp, so i don't understand it.

Link to comment
https://forums.phpfreaks.com/topic/74191-a-very-weird-thing/#findComment-375364
Share on other sites

You need to do more debugging of your scripts. Echo your arrays and variable at critical points. If you are using sessions, make sure you're not reusing the same session variable for more than one meaning.

 

We won't be able to help you without seeing all the relevant code.

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/74191-a-very-weird-thing/#findComment-375368
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.