PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
my query that adds the post to the database dies. How can i get php to parse in 'odd' characters and translate them in such a way that $post can be added to the database?
function addPost($UserID,$ThreadID,$ForumID,$text)
{
$user="root";
$host="+++++";
$password="+++++";
$database="forum";
$connection=mysql_connect($host,$user,$password) or die ("Couldnt connect to server");
$db=mysql_select_db($database,$connection) or die ("Couldnt select database");
$escaped_item = mysql_escape_string($text);
echo "<br>$escaped_item";
$query="INSERT INTO posts(threadID,forumID,posterID,text,timeCreated)
VALUES ($ThreadID,$ForumID,$UserID,'$text',NULL)";
$result=mysql_query($query) or die ("Couldnt execute query to add post into database");
return true;
}
addPost($PosterID,$ThreadID,1,$post);
This function works perfectly well when i use 'normal' characters