vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Last 10 threads error ! (https://vborg.vbsupport.ru/showthread.php?t=11453)

veedee 03-15-2001 11:05 AM

Please help.
Could you go to www.visordown.com/forums and click on office pal at the top.

Apparantly it does not owrk which is really annoying.

anyway here is the code

Code:

<HTML>
<HEAD>
<TITLE></TITLE>
<STYLE type=text/css>



A:active  {COLOR: #000000 ;}
A:visited  {COLOR: #333333 ; text-decoration: none ;}
A:hover    {COLOR: #666666; text-decoration: underline ;}
A:link    {COLOR: #000000; text-decoration: none ;}

</STYLE>
</HEAD>
<body leftmargin=0 rightmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgColor="#FFFFFF">
<br>
<center><font face="verdana" size="2"><a href="javascript:window.location.reload()">Click here to refresh</a>&nbsp;&nbsp;&nbsp;<a href="javascript:window.close();">Click here to close window</a></center>

<!-- ## START THREAD TABLE  ## -->

<br>
<?php

require("http://www.visordown.com/forums/global.php");

$db_link = @mysql_pconnect("$dbservername", "$dbusername", "$dbpassword");
mysql_select_db("$dbname");

?>

<table cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="#DDDDDD">
<td><font color="#000000" face="verdana" size="2"><small><strong>Show the last 10 threads</strong></small></td>
<td align="center"><font color="#000000" face="verdana" size="2"><small><strong>REPLIES</strong></small></td>
<td align="center"><font color="#000000" face="verdana" size="2"><small><strong>VIEWS</strong></small></td>
</tr>
<?php
$lastten = lastten();
while( $row = mysql_fetch_row($lastten) )
{
print('<tr bgcolor="#F2F0F0">');
print('<td>');
print('<font size="2" face="verdana"><a href="http://www.visordown.com/forums/showthread.php?s=&threadid=');
print($row[0]);
print('" target="_blank">');
print($row[1]);
print('</a></td>');
print('<td align="center">');
print($row[2]);
print('</td>');
print('<td align="center">');
print($row[3]);
print('</td>');
print('</tr>');
}
mysql_free_result ($lastten);
?>
</table>

<?php

function lastten()
{
$query = 'SELECT threadid, title, replycount, views ' .
'FROM thread ' .
'WHERE (' . $cur_time . '-lastpost) < 604800 ' .
'ORDER BY threadid DESC LIMIT 10';
$result = mysql_query($query)
or die('most_viewed query failed');
return($result);
}

?>


</BODY>
</HTML>

(I have snipped out the top3 posters as i dont want that)


Could you help me make it work, and ideally I woudl like to show the last 10 posts not threads.

I know its a long shot, but I hope it can be done.

cheers,

~veedee

03-15-2001 05:56 PM

Did you even bother to read global.php before you included it? Or noticed that it included db_mysql.php? Or noticed that you are already connected to the database and provided with a group of functions to interact with the MySQL db already?

I don't think so. I wish people would bother to do a little more research on their own.

03-16-2001 04:37 AM

Quote:

Originally posted by leadZERO
Did you even bother to read global.php before you included it? Or noticed that it included db_mysql.php? Or noticed that you are already connected to the database and provided with a group of functions to interact with the MySQL db already?

I don't think so. I wish people would bother to do a little more research on their own.

Sorry mate didnt realise this was the bad reactions party.

I know squat about PHP so when something goes wrong, people help and i *gradually* pick things up.

I have search for it, had a look at hot scripts for tutorials, tried on my own, but still nothing. I have asked 3 people on icq, no solutions there.

Were you born with PHP installed in your brain or did someone stop off along the way to share their *precious* time to help you then, so that now you can shred me in your replies as you know it all.

Community spirit, conceptualised in your reply I would say.

sorry to waste your time reading and replying to a thread, i should have thought about you when i posted it.
:(

03-16-2001 05:31 AM

Not everyone is PHP expert as you leadZERO. Someone knows that and someone knows this. We share our knowledge to learn something new and that's why we post posts like this one - to help someone else and show him/her a way to do it correctly and the most efficiently.
I don't think you your self would be pleased by response like this.

Please, consider your words before you click on submit.

03-16-2001 06:54 AM

Try this :)

lastten.php
Code:

<?php

$templatesused = "lastten,lasttenbit";
require ("./global.php");

$threads = $DB_site->query("
        SELECT thread.*, forum.*,
                thread.title AS threadtitle,
                forum.title AS forumtitle
        FROM thread
        LEFT JOIN post ON (post.threadid = thread.threadid)
        LEFT JOIN forum ON (forum.forumid = thread.forumid)
        GROUP BY thread.threadid
        ORDER BY thread.lastpost DESC LIMIT 0,10");

while ($thread = $DB_site->fetch_array($threads)) {
        if (($counter++ % 2) == 0)
                $backcolor = "{ secondaltcolor }";
        else
                $backcolor = "{ firstaltcolor }";
        $lastpost = vbdate("$timeformat $dateformat", $thread[lastpost]);
        eval("\$lasttenbits .= \"".gettemplate('lasttenbit')."\";");
}

eval("dooutput(\"".gettemplate('lastten')."\");");

?>

template - lastten
Code:

{ htmldoctype }
<HTML>
<HEAD><TITLE>$pagetitle</title>
$headinclude
</head>
<body>
$header

<!-- border colour table -->
<table cellpadding=0 cellspacing=0 border=0
        bgcolor="{ tablebordercolor }" width="{ tablewidth }" align="center">
        <tr><td>

<table cellpadding=4 cellspacing=1 border=0 width=100%>
<tr bgcolor="{ tableheadbgcolor }">
        <td colspan=5><normalfont color="{ tableheadtextcolor }"><b>Last ten modified threads</b></normalfont></td>
</tr>
<tr bgcolor="{ firstaltcolor }">
        <td><smallfont>Thread</smallfont></td>
        <td><smallfont>Forum</smallfont></td>
        <td><smallfont>Replies</smallfont></td>
        <td><smallfont>Views</smallfont></td>
        <td><smallfont>Last Post</smallfont></td>
</tr>
$lasttenbits
</table>

        </tr></td>
</table>
<!-- /border colour table -->

$footer

</body>
</html>

template - lasttenbit
Code:

<tr bgcolor="$backcolor">
        <td><normalfont><a href="showthread.php?s=$session[sessionhash]&threadid=$thread[threadid]">$thread[threadtitle]</a></normalfont></td>
        <td><normalfont><a href="forumdisplay.php?s=$session[sessionhash]&forumid=$thread[forumid]">$thread[forumtitle]</a></normalfont></td>
        <td><normalfont>$thread[replycount]</normalfont></td>
        <td><normalfont>$thread[views]</normalfont></td>
        <td><normalfont>$lastpost</normalfont></td>
</tr>

You will need to remove the spaces from all the {xxx} replacement variables.

I think that was what you were asking for? :)

03-16-2001 07:30 AM

Big thanks to PeF, SgtSling, and Kier for helping me on this, both over ICQ and here.

I have to say sorry for basically asking for people to hold my hand through the whole process, but I did get completely stuck.

No worries as I am happy again :)


STOP !!!











CARRY ON !!

~veedee


All times are GMT. The time now is 05:03 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01017 seconds
  • Memory Usage 1,741KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete