biggiebi 0 Report post Posted October 15, 2007 I found this php code and I want to know how do I use it?It's a BBC code thing.I want it like if I posted [url=http://link]linkname[/url] it becomes <a href=http://link>linkname</a> Share this post Link to post Share on other sites
toby 0 Report post Posted October 15, 2007 https://www.google.co.uk/webhp?hl=en&gws_rd=sslQuite a few of them look good. It would help to understand php to understand the code you found, but all these tutorials do explain it well. Share this post Link to post Share on other sites
biggiebi 0 Report post Posted October 16, 2007 Well I'm trying to get data from my MySQL database and post it on my frontpage.This is the query SELECT name, message, poster FROM flexbb_threads WHERE id = 1and the message is in BBC. so yeah... Share this post Link to post Share on other sites
pyost 0 Report post Posted October 16, 2007 $result = mysql_query("SELECT `name`, `message`, `poster`, FROM `flexbb_threads` WHERE `id` = 1");$data = mysql_fetch_array($result);$data['message'] = parse_bbcode($data['message']);echo $data['name'] . '<br />';echo $data['message']; First, you retrieve the message from the database and insert one message data into an array (you would call mysql_fetch_array() again for the next row in the result set). After that, you call the function that will replace the BBCode with HTML code; of course, you need to write this yourself (or download appropriate PHP code from a scripting web site), as it is not a part of PHP (I recommend doing so with regular expressions). Finally, you are ready to output data. Share this post Link to post Share on other sites
biggiebi 0 Report post Posted October 16, 2007 ok so how do i make it show all thread in flexbb_thread? Share this post Link to post Share on other sites
pyost 0 Report post Posted October 16, 2007 For that, you will need to learn MySQL. As I don't know the structure of flexbb_thread, nor exactly what you want to do, I can't help you. Share this post Link to post Share on other sites
biggiebi 0 Report post Posted October 17, 2007 I've tried this to show all the content of the announcements forum. $result = mysql_query("SELECT name, message, poster FROM flexbb_threads WHERE forumid = 1");$data = mysql_fetch_array($result);echo $data['message'];name is the Title of the thread, message is the content, poster is the poster. forumid is the forum. forumid = 1 is the announcements. so yeahhttp://forums.xisto.com/no_longer_exists/ Share this post Link to post Share on other sites
pyost 0 Report post Posted October 17, 2007 When you use SELECT in MySQL, you are given a results table if there are multiple rows. mysql_fetch_array returns only one row, so you would have to use a loop in order to display all the announcements.. Â $result = mysql_query("SELECT `name`, `message`, `poster`, FROM `flexbb_threads` WHERE `forumid` = 1");while ( $data = mysql_fetch_array($result) ) { echo $data['message'] . '<br />';} Share this post Link to post Share on other sites
biggiebi 0 Report post Posted October 19, 2007 (edited) well could you help me with this? <?php$dbhost = 'host';$dbuser = 'username';$dbpass = 'password';$dbname = 'database';$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');mysql_select_db($dbname);$result = mysql_query("SELECT name, message, poster FROM flexbb_threads WHERE id = 1");$data = mysql_fetch_array($result);$data['message'] = bb2html($data['message']);?> <div align="center"> <table border="0" width="85%" class="contentbox"> <tr> <td class="topic"><?php echo $data['name']; ?></td> </tr> <tr> <td class="contenttext"> <?php echo $data['message']; ?> </td> </tr> <tr> <td class="by"> Written by <?php echo $data['poster']; ?></a> </td> </tr> </table> </div><br><br><?php mysql_close($conn); ?> Edited October 19, 2007 by biggiebi (see edit history) Share this post Link to post Share on other sites
pyost 0 Report post Posted October 19, 2007 That should do it, as long as the bb2html functions properly Share this post Link to post Share on other sites
biggiebi 0 Report post Posted October 20, 2007 That should do it, as long as the bb2html functions properly I can't use the while function when I use the bbc function. I dunno if its me or wuh but iono. Share this post Link to post Share on other sites