Webmaster Key - Discussion Forums


Welcome, Guest. Please login or register.
Did you miss your activation email?
February 09, 2012, 07:10:33 AM

Login with username, password and session length
Welceome to Forums!

Important information for guests and new members:

In order to understand the full benefits of becoming an active member of this forum, please review the following information on guest and new member restrictions. These forum changes have been prompted by an overwhelming and unreasonable amount of bot postings and incoherent guest spam messages. We wish to prevent these events from happening in the future and make our community a more comfortable place for all of our members.

For guests:

Guests are not allowed to open new topics, polls, or posts attachments.
If you wish to open up new discussions on this forum, we encourage you to register.

For new members:

New members with less than five posts are not allowed to modify additional profile information such as avatars, contact information, biographies, and signatures. However, new members are encouraged to post their own topics or reply to topics initiated by other members. Become active on the forums and 5 posts should be an easy task!

We are a diverse community with members from all over the world. We encourage new ideas and interesting conversation. Do not be afraid to post webmaster/computer-related questions or problems, as our active members are always willing to help when they are able. Interested? Join us.

+ Webmaster Key Forums
|-+ Webmaster Corner
| |-+ Site Design and Web Authoring
| | |-+ Coding Talk
| | | |-+ Php, database fourm
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Stumble Upon! Digg It! del.icio.us! Add to Technorati! ReddIt!  Send this topic Print
Author Topic: Php, database fourm  (Read 2061 times)
stu
Key Keeper
Member
**
Posts: 83



WWW
« on: June 17, 2009, 12:03:49 PM »

Hi,

I thought about something last night and i have been trying to find away around it all day and so far i have come up with nothing, Now its starting to bug me as i no it can be done just dont know how.

Say for example i was to build a fourm, this would be a database driven forum. very similar to this one. A user asks a question regarding to coding, they put a snipit of code say 

<table with="100" border="1">
<tr>
<td>
</td>
</tr>
</table>

the message would be inserted into the database field which would be a text area. users who view the message would go to the page and the message would be called from the database.

my question is, when the message is called from the database how do i go about getting the code to display as the code example rather than the browser interpritating it and displaying a table when it is called back from the database?

thanks in advanced
Report to moderator   Logged

Andy
Administrator
Veteran
*****
Posts: 5 752



« Reply #1 on: June 19, 2009, 02:10:51 PM »

Howdy Stu  Grin

What you need to do is to use the PHP functions to encode and decode HTML before and after saving and retrieving the post from your database.

Actually, this is a difficult task IMO and you are maybe better off reverse-engineering how others have done it before. For example by studying existing scripts such as MYBB that handle this OK.

For a start on the PHP, check out: http://www.php.net/htmlentities

All the best, Andy
Report to moderator   Logged

Pages: [1] Go Up Stumble Upon! Digg It! del.icio.us! Add to Technorati! ReddIt!  Send this topic Print 
+ Webmaster Key Forums
|-+ Webmaster Corner
| |-+ Site Design and Web Authoring
| | |-+ Coding Talk
| | | |-+ Php, database fourm

Jump to:  
« previous next »


Our Partners
RelmaxTOP Ranking System Web Hosting RelmaxTOP Ranking System
Staff Sites
12Noon[12Noon Gallery] Andy[Urgentclick]
Tamuril[Tamuril's Digital Art Exhibit] Sensovision
Powered by MySQL Powered by PHP We are hosted by Relmax Inc. |Our Privacy Policy | Sitemap
Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC
Forum design by Tamuril © 2005.
Valid XHTML 1.0! Valid CSS!