Here is my php:
<?php
require included.php; //which contains the function getpost($post_id)
//once I use the getpost() function below to return a string which is the post 
//content, then I can not insert this new row to database.if I change it something 
//like $post_content='this is the post content' , it would insert a row to database
$post_content=getpost($post_id);
if($insert=mysql_query("INSERT INTO `join` VALUES('','username','$post_content')"))
{
   echo 'ok';
}
else{
   echo 'error';
}
?>
Here is the function getpost($post_id) in the included.php:
function getpost($post_id){
    $select_post=mysql_query("SELECT `post_text` FROM `user_post` WHERE `id`='$post_id' ");
return mysql_result($select_post,0,'post_text');
}
those data would be sent back to jquery AJAX request as data, and if I echo the $post_content = get_post($post_id), I can alert the right stuffs, it seems something wrong to use a function to get the post content then it can't be inserted into the database.
 
     
     
     
    