Firefox PHP

Last X topics (and no posts)

Posted by Clément 
Re: Last X topics (and no posts)
September 15, 2005 12:23PM
Now it works.......but the link URL is wrong.

The link I get is like this:
http://www.exsampel.com/read.php?1,22,28#28

instead of

http://www.exsampel.com/phorum/read.php?1,22,28#28

And it writs #28 instead of #msg-28 ?

Another thing:

If I want to show the 2 last posts, how is this don.
I tried something like this:


echo $p[0]['author']." wrote about ".$p[0]['subject']." at ".$p[0]['datestamp']."";
echo "<p>".$p[0]['body']."</p>";

echo $p[1]['author']." wrote about ".$p[1]['subject']." at ".$p[1]['datestamp']."";
echo "<p>".$p[1]['body']."</p>";

But this doesn’t give me the 2 last post, only the last poste and another post!

Hope you can help me again. :-)

Regarts

Troels



Edited 3 time(s). Last edit at 09/15/2005 12:25PM by dragonbook.
Re: Last X topics (and no posts)
September 28, 2005 04:31AM
Hhhm, after loosing some of data I have to reisntall this with my smarty. I am backstepping all of it now but get this error:

Failed Query of You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'where parent_id = 0 and status = 2 order by datestamp desc limi

Sergej

------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------
Re: Last X topics (and no posts)
September 28, 2005 07:01AM
Didn't you get more info than this? I would expect more info about the error after "datestamp desc limi" in the part you pasted, e.g. the full query that was executed.
Re: Last X topics (and no posts)
September 28, 2005 08:15AM
Nope thats just it....no error log......beats me. I checked, I filled in the database values also correctly....

Sergej

------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------
Re: Last X topics (and no posts)
September 29, 2005 10:32AM
Ok, I noticed that all the version in this thread use some ancient code and I have since cleaned it up little.

So I updated the code, added some documentation and examples so it should be maybe a little easier for newbies and civilians to understand. it even should output something if db settings are correct.

Attached is the latest version...


---
-=[ Panu ]=-
Attachments:
open | download - latestthreads_051029.zip (2.5 KB)
Re: Last X topics (and no posts)
September 29, 2005 10:44AM
Ha ha ha ha, after the same error I got it running. Die you mother....... I nailed you.

Ok, after drinking 2 cans of Dr. Pepper I woke and did this:
Leave all fields blank but just put this above:
include_once ("common.php");

I tried it without the common and just putting the dbase fields in there but that didnt work for some strange Twilight Zone reason.

Anyways Panu, as Wayne said. I am not worthy.....hmmmm, let me create an avatar of that.

Cheers mate you made my day.

Sergej

------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------



Edited 1 time(s). Last edit at 09/29/2005 10:50AM by Sergej.
Re: Last X topics (and no posts)
September 29, 2005 10:55AM
edit: ok, it was a db problem...

$host = $PHORUM[DBCONFIG][localhost];
$dbuser = $PHORUM[DBCONFIG][myusername];
$dbpass = $PHORUM[DBCONFIG][mepassword];
$dbname = $PHORUM[DBCONFIG][medbasename];

this should be something like:

$host = "localhost";
$dbuser = "yourusername";
$dbpass = "yourpassword";
$dbname = "yourdb";

And it's weird that the sql error message is cut...

replace the corresponding lines in the script with this:


$select_db = mysql_select_db($dbname, $con); 
$t_query = "select * from ".$table." where parent_id = 0 and status = 2 order by datestamp desc limit ".$number;
echo "<br/>".$t_query."<br/>";
$result = mysql_query($t_query) or die("Failed Query of " . $result. mysql_error());


---
-=[ Panu ]=-



Edited 1 time(s). Last edit at 09/29/2005 10:59AM by Panu.
Re: Last X topics (and no posts)
October 06, 2005 10:15AM
Problem fixed. NvM

Sergej

------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------



Edited 1 time(s). Last edit at 10/06/2005 11:59AM by Sergej.
Re: Last X topics (and no posts)
January 05, 2007 08:05AM
Long time no update.

After reading recent mysql.php I noticed modifystamp is used with message table. Out of curiosity I changed datestamp to modifystamp to see if it would solve my old problem of getting the latest message from the most recent (updated) threads.

And it seems to work.

So I changed this add-on to reflect that and updated the documentation a little too.

Note! I'm not sure when the modifystamp was added or if it was there all along, maybe I was just too blind to notice it earlier, I'm not even sure if it works as I imagine it does. Seems to work for my purposes currently anyway.

---
-=[ Panu ]=-
Attachments:
open | download - latestthreads-2007-05-01.zip (2.7 KB)
Re: Last X topics (and no posts)
August 18, 2007 04:25AM
Panu, do you get a Session ID as well behind the normal Phorum links?

Sergej

------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------
Sorry, only registered users may post in this forum.

Click here to login