Jump to content

Recommended Posts

hey guys, i am stuck.

 

i have a place for people to post with bbcode (written with javascript), the data is posted and sent to a mysql database, and retrieved from my website's page, where it is displayed.

 

when the data shows up on the page, the bbcode is still visible. is there a php script for this? if there is where would i put it? on the website's page?

There are many script's out there to do this.

It's actually very simple to make it.

 

Example to take [ b] to < b>.

<?php
function bbcode($String){
if (empty($string)){
return false; 
}
$String = srt_replace("[b]","<b>",$String);
return $String;
}
?>

it's not working. i probably did something wrong. for example:

 


 function bbcode($String){
if (empty($string)){
return false; 
}
$String = srt_replace("[b]","<b>",$String);
return $String;
}

$host="localhost"; // Host name
$username="bleep"; // Mysql username
$password="bleep"; // Mysql password
$db_name="bleep"; // Database name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql = "SELECT * FROM headlines ORDER BY id DESC LIMIT 2";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {
$current = $row['pagecontent'];
bbcode($current);
echo $current;
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.