Hi,
it's not a problem for me to access the database and find the body of a forum message.
But How do I get PHP to parse the message for BB-Codes and "translate" them into HTML just as the forum does it?
Thx. :)
require_once("Subs.php");
// pull the post from the database. Assuming the variable $post has the body of the post in it
echo parse_bbc($post);
Thx, it worked.
Now I have a random movie review on my start page :-)
http://www.dvdcollectorsonline.com/index.php
DJ,
This seems to work very well on your site. Any chance you could post the entire code snippet for that article and we can find some place to put it so others can take advantage of what you have done if they want to?
Thanks,
ZarPrime
Hi,
it's rather specific code that depends a lot on our forum structure. But if there's still interest I have no problem.
But I have another problem. I open a MySQL connection, do my stuff and close it again. But if I do that, IE(7) doesn't show any page but a browser-generic error message that he can't display the page.
If I remove the close command, it works. I even tried to rename the variable in case it collides with some other, but it didn't help.
How the hell does IE even know that I close on a server-side PHP script a database connection?
I certainly don't know the answer to that one. JPDeni might be able to come to your aid on that one as she's much more attuned to the workings of the database and such.
I only thought that what you were doing with this might be of interest to others, that's why I mentioned it.
ZarPrime
QuoteI open a MySQL connection, do my stuff and close it again
Don't do that. The MySQL connection is already open before the article is rendered and will close on its own after the whole page is finished.
QuoteHow the hell does IE even know that I close on a server-side PHP script a database connection?
It's not IE. It's the database.
The best way to access the database is through the SMF itself:
global $db_prefix;
$query = db_query("SELECT blah blah bla
FROM {$db_prefix}table name
WHERE blah blah
AND blah blah
ORDER BY blah
LIMIT whatever", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query)) {
// process the data using the variables $row['field name']
}