shalli Posted August 24, 2010 Share Posted August 24, 2010 Hi there Been trying to figure this out but how do you limit charachters on a mysql query <?php //$qry="select * from news where status=1 order by date_Added DESC"; $qry="select * from wp_posts order by post_date DESC"; $sql=mysql_query($qry,$connBlog); //$news=mysql_fetch_array(); while($news=mysql_fetch_array($sql)){ $arr[]=$news['post_title', 0, 25];?> js_ar.push("<?=$news['post_title']?>"); <?php }?> thanks shalli Link to comment https://forums.phpfreaks.com/topic/211593-how-to-limit-charachters-from-a-database-query/ Share on other sites More sharing options...
mikosiko Posted August 24, 2010 Share Posted August 24, 2010 2 possible options: a) use the SUBSTRING() function directly in your sql query b) use the SUBSTR() function in PHP Link to comment https://forums.phpfreaks.com/topic/211593-how-to-limit-charachters-from-a-database-query/#findComment-1103095 Share on other sites More sharing options...
shalli Posted December 31, 2010 Author Share Posted December 31, 2010 Thanks mikosiko For all your help!! Link to comment https://forums.phpfreaks.com/topic/211593-how-to-limit-charachters-from-a-database-query/#findComment-1153314 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.