unemployment Posted October 6, 2011 Share Posted October 6, 2011 I'm storing a blog post in MySQL and it has html entities in it. I tried doing... $info = fetch_blog_post_mini_profile_by_pid($_GET['pid']); $info = substr($info, 0, 200); to get a summary of the content, but it says it's not a string. What am I missing? Quote Link to comment https://forums.phpfreaks.com/topic/248557-not-a-string/ Share on other sites More sharing options...
AyKay47 Posted October 6, 2011 Share Posted October 6, 2011 what is the return set to in your custom function? Quote Link to comment https://forums.phpfreaks.com/topic/248557-not-a-string/#findComment-1276475 Share on other sites More sharing options...
unemployment Posted October 6, 2011 Author Share Posted October 6, 2011 function fetch_blog_post_mini_profile_by_pid($pid) { $pid = (int)$pid; $sql = "SELECT `postcontent` FROM `blog_posts` WHERE `post_id` = '${pid}'"; $result = mysql_query($sql); return mysql_fetch_assoc($result); } Quote Link to comment https://forums.phpfreaks.com/topic/248557-not-a-string/#findComment-1276478 Share on other sites More sharing options...
AyKay47 Posted October 6, 2011 Share Posted October 6, 2011 mysql_fetch_assoc returns an array of data not a string.. Quote Link to comment https://forums.phpfreaks.com/topic/248557-not-a-string/#findComment-1276481 Share on other sites More sharing options...
unemployment Posted October 6, 2011 Author Share Posted October 6, 2011 looks like I made another dumb mistake. Good call out. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/248557-not-a-string/#findComment-1276482 Share on other sites More sharing options...
AyKay47 Posted October 6, 2011 Share Posted October 6, 2011 no problem.. Quote Link to comment https://forums.phpfreaks.com/topic/248557-not-a-string/#findComment-1276486 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.