Display Last 5 Phorum Posts -script
Posted by dagon
Re: Display Last 5 Phorum Posts -script July 13, 2004 01:43PM |
Registered: 20 years ago Posts: 666 |
So unapproved messages have the status number of -1.
$result = mysql_query("SELECT * FROM $table m, $forum_table f WHERE m.forum_id = f.forum_id AND f.forum_id != 31 AND f.forum_id != 2 AND f.parent_id !=22 AND m.status > 0 ORDER BY m.datestamp DESC limit $number") or die("Failed Query of " . $result. mysql_error());
AND m.status > 0 as you say would keep out -1 and -2, leaving just approved messages, and not the hidden or unapproved ones, yes? I see, thank you.
$result = mysql_query("SELECT * FROM $table m, $forum_table f WHERE m.forum_id = f.forum_id AND f.forum_id != 31 AND f.forum_id != 2 AND f.parent_id !=22 AND m.status > 0 ORDER BY m.datestamp DESC limit $number") or die("Failed Query of " . $result. mysql_error());
AND m.status > 0 as you say would keep out -1 and -2, leaving just approved messages, and not the hidden or unapproved ones, yes? I see, thank you.
Re: Display Last 5 Phorum Posts -script July 13, 2004 02:22PM |
Admin Registered: 21 years ago Posts: 9,240 |
Re: What did I forget August 03, 2004 04:38AM |
Registered: 21 years ago Posts: 868 |
Get this: Failed Query of No Database Selected
What did I miss?
include_once("common.php"); //change to match your file system
$host = $PHORUM[DBCONFIG]["localhost"];
$dbuser = $PHORUM[DBCONFIG]["fluffy"];
$dbpass = $PHORUM[DBCONFIG]["fluffypass"];
$dbname = $PHORUM[DBCONFIG]["fluffy_nukefluffy"];
$table = $PHORUM["phorum_messages"];
$forum_table = $PHORUM["phorum_forums"];
$number = 50; // number of messages to show.
@$con=mysql_connect($host,$dbuser,$dbpass) or die ("cannot connect to MySQL");
$select_db = mysql_select_db($dbname,$con);
$result = mysql_query("select * from $table m, $forum_table f where m.forum_id = f.forum_id order by m.datestamp desc limit $number") or die("Failed Query of " . $result. mysql_error());
while($row = mysql_fetch_array($result)){
$row[datestamp] = strftime($PHORUM["short_date"], $row["datestamp"]);
echo "<p>$row[name]: <a href=\"".$PHORUM[SETTINGS][http_path]."/read.php?". $row[forum_id].",".$row[thread].",".$row[message_id]."#".$row[message_id]."\">" .$row[subject]. "</a>";
echo " ".$row[datestamp];
echo " by ". $row[author]. "</p>";
}
Sergej
------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------
What did I miss?
include_once("common.php"); //change to match your file system
$host = $PHORUM[DBCONFIG]["localhost"];
$dbuser = $PHORUM[DBCONFIG]["fluffy"];
$dbpass = $PHORUM[DBCONFIG]["fluffypass"];
$dbname = $PHORUM[DBCONFIG]["fluffy_nukefluffy"];
$table = $PHORUM["phorum_messages"];
$forum_table = $PHORUM["phorum_forums"];
$number = 50; // number of messages to show.
@$con=mysql_connect($host,$dbuser,$dbpass) or die ("cannot connect to MySQL");
$select_db = mysql_select_db($dbname,$con);
$result = mysql_query("select * from $table m, $forum_table f where m.forum_id = f.forum_id order by m.datestamp desc limit $number") or die("Failed Query of " . $result. mysql_error());
while($row = mysql_fetch_array($result)){
$row[datestamp] = strftime($PHORUM["short_date"], $row["datestamp"]);
echo "<p>$row[name]: <a href=\"".$PHORUM[SETTINGS][http_path]."/read.php?". $row[forum_id].",".$row[thread].",".$row[message_id]."#".$row[message_id]."\">" .$row[subject]. "</a>";
echo " ".$row[datestamp];
echo " by ". $row[author]. "</p>";
}
Sergej
------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------
Re: What did I forget August 03, 2004 04:47AM |
Admin Registered: 21 years ago Posts: 9,240 |
whats that?
$host = $PHORUM[DBCONFIG]["localhost"];
$dbuser = $PHORUM[DBCONFIG]["fluffy"];
$dbpass = $PHORUM[DBCONFIG]["fluffypass"];
$dbname = $PHORUM[DBCONFIG]["fluffy_nukefluffy"];
do you want to use the vars you have there in the end?
this should be better IMO.
$host = "localhost";
$dbuser = "fluffy";
$dbpass = "fluffypass";
$dbname = "fluffy_nukefluffy";
Thomas Seifert
$host = $PHORUM[DBCONFIG]["localhost"];
$dbuser = $PHORUM[DBCONFIG]["fluffy"];
$dbpass = $PHORUM[DBCONFIG]["fluffypass"];
$dbname = $PHORUM[DBCONFIG]["fluffy_nukefluffy"];
do you want to use the vars you have there in the end?
this should be better IMO.
$host = "localhost";
$dbuser = "fluffy";
$dbpass = "fluffypass";
$dbname = "fluffy_nukefluffy";
Thomas Seifert
Re: What did I forget August 03, 2004 04:50AM |
Registered: 21 years ago Posts: 868 |
OK, took away the vars, and I get this:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/rodos/public_html/phorum/newest.php on line 11
Sergej
------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/rodos/public_html/phorum/newest.php on line 11
Sergej
------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------
Re: What did I forget August 03, 2004 04:52AM |
Admin Registered: 21 years ago Posts: 9,240 |
Re: What did I forget August 03, 2004 04:52AM |
Registered: 21 years ago Posts: 868 |
include_once("common.php"); //change to match your file system
$host = $PHORUM[DBCONFIG]"localhost";
$dbuser = $PHORUM[DBCONFIG]"*****";
$dbpass = $PHORUM[DBCONFIG]"****";
$dbname = $PHORUM[DBCONFIG]"****";
$table = $PHORUM "phorum_messages";
$forum_table = $PHORUM "phorum_forums";
$number = 50; // number of messages to show.
@$con=mysql_connect($host,$dbuser,$dbpass) or die ("cannot connect to MySQL");
$select_db = mysql_select_db($dbname,$con);
$result = mysql_query("select * from $table m, $forum_table f where m.forum_id = f.forum_id order by m.datestamp desc limit $number") or die("Failed Query of " . $result. mysql_error());
while($row = mysql_fetch_array($result)){
$row[datestamp] = strftime($PHORUM["short_date"], $row["datestamp"]);
echo "<p>$row[name]: <a href=\"".$PHORUM[SETTINGS][http_path]."/read.php?". $row[forum_id].",".$row[thread].",".$row[message_id]."#".$row[message_id]."\">" .$row[subject]. "</a>";
echo " ".$row[datestamp];
echo " by ". $row[author]. "</p>";
}
Sergej
------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------
$host = $PHORUM[DBCONFIG]"localhost";
$dbuser = $PHORUM[DBCONFIG]"*****";
$dbpass = $PHORUM[DBCONFIG]"****";
$dbname = $PHORUM[DBCONFIG]"****";
$table = $PHORUM "phorum_messages";
$forum_table = $PHORUM "phorum_forums";
$number = 50; // number of messages to show.
@$con=mysql_connect($host,$dbuser,$dbpass) or die ("cannot connect to MySQL");
$select_db = mysql_select_db($dbname,$con);
$result = mysql_query("select * from $table m, $forum_table f where m.forum_id = f.forum_id order by m.datestamp desc limit $number") or die("Failed Query of " . $result. mysql_error());
while($row = mysql_fetch_array($result)){
$row[datestamp] = strftime($PHORUM["short_date"], $row["datestamp"]);
echo "<p>$row[name]: <a href=\"".$PHORUM[SETTINGS][http_path]."/read.php?". $row[forum_id].",".$row[thread].",".$row[message_id]."#".$row[message_id]."\">" .$row[subject]. "</a>";
echo " ".$row[datestamp];
echo " by ". $row[author]. "</p>";
}
Sergej
------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------
Re: What did I forget August 03, 2004 04:53AM |
Admin Registered: 21 years ago Posts: 9,240 |
Re: What did I forget August 03, 2004 04:56AM |
Registered: 21 years ago Posts: 868 |
yea, I noticed. Sorry, had a late night.
Sergej
------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------
Sergej
------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------
Re: What did I forget September 30, 2004 10:07AM |
Registered: 19 years ago Posts: 8 |
I want to include this on my main index page (not the index page from the forum) so i just included it there with include_once("phorum5_top5.php").
My directory structure is:
- phorum5_top5.php (the add-on)
- index.php (my main page)
- phorum (my phorum5 folder)
In the phorum5_top5.php, i changed this line:
include_once("phorum/common.php"); //change to match your file system
When viewing my index page, i get a lot of errors:
(please note that i'm trying this out on my localhost, with easyphp, but it is the same when i put it online (the directory names are ofcourse different)
Warning: Failed opening './include/constants.php' for inclusion (include_path='.;C:\Program Files\EasyPHP\php\pear\') in c:\program files\easyphp\www\phorum\common.php on line 31
Warning: Failed opening './include/db/config.php' for inclusion (include_path='.;C:\Program Files\EasyPHP\php\pear\') in c:\program files\easyphp\www\phorum\common.php on line 105
Warning: Failed opening './include/db/.php' for inclusion (include_path='.;C:\Program Files\EasyPHP\php\pear\') in c:\program files\easyphp\www\phorum\common.php on line 110
Fatal error: Call to undefined function: phorum_db_load_settings() in c:\program files\easyphp\www\phorum\common.php on line 113
My directory structure is:
- phorum5_top5.php (the add-on)
- index.php (my main page)
- phorum (my phorum5 folder)
In the phorum5_top5.php, i changed this line:
include_once("phorum/common.php"); //change to match your file system
When viewing my index page, i get a lot of errors:
(please note that i'm trying this out on my localhost, with easyphp, but it is the same when i put it online (the directory names are ofcourse different)
Warning: Failed opening './include/constants.php' for inclusion (include_path='.;C:\Program Files\EasyPHP\php\pear\') in c:\program files\easyphp\www\phorum\common.php on line 31
Warning: Failed opening './include/db/config.php' for inclusion (include_path='.;C:\Program Files\EasyPHP\php\pear\') in c:\program files\easyphp\www\phorum\common.php on line 105
Warning: Failed opening './include/db/.php' for inclusion (include_path='.;C:\Program Files\EasyPHP\php\pear\') in c:\program files\easyphp\www\phorum\common.php on line 110
Fatal error: Call to undefined function: phorum_db_load_settings() in c:\program files\easyphp\www\phorum\common.php on line 113
Sorry, only registered users may post in this forum.