I have a problem and question. I am a new user to PHP so I don't know anything. I just bought a book so hopefully I will learn something from that but I have a question that someone will hopefully be able to provide the code for.
On my website I have phpBB forums, I also have php-NUKE installed. I am trying to take the News from my "News and Announcements" forum and post them on the front page of my site. I talked to some friends and they said I could do it using javascript or php, and I have been searching the internet for code to help me, but to no avail.
If anyone could help, that would be awesome. Thanks, Linil
Fetching News
Moderator: General Moderators
Well using JavaScript is out the question because it can't read anything from the server (like the database that phpBB uses).
I won't write the code for you because it will take too long, and it's something that you're going to have trouble with if you don't know PHP.
You will need to work out which database table contains all of the "News and Announcements" forum posts.... You then need to use the PHP MySQL functions to load the relevant info into PHP from the database.... Once you've done that it's then a simple matter of getting PHP to print the info into your page.
Here's a quick example...
... it is only a very basic example and won't work if you just chuck it into your web page.
I won't write the code for you because it will take too long, and it's something that you're going to have trouble with if you don't know PHP.
You will need to work out which database table contains all of the "News and Announcements" forum posts.... You then need to use the PHP MySQL functions to load the relevant info into PHP from the database.... Once you've done that it's then a simple matter of getting PHP to print the info into your page.
Here's a quick example...
Code: Select all
$db = mysql_connect($server, $username, $password);
mysql_db_select($table);
$info = mysql_query(" SELECT * FROM `$table` ");
while($i = mysql_fetch_array($info))
{
echo(nl2br(stripslashes($i[0])));
}
mysql_clsoe($db);