For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > August 2004 > Re: MySQL limited output









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: MySQL limited output
Bza

2004-08-18, 3:57 pm

First fetch the news into a variabel and then use substr()
Example:
--------

<?php
id = _GET['id'];
a = "SELECT * FROM news WHERE id = 'id'";
b = mysql_query(a);
while(c = mysql_fetch_object(b)) :
news = c->news;
short_news = substr(news, 0, 50); // Returns the
first 50 characters...
echo short_news;
endwhile;
?>
--------

Bza
http://www.bzabza.com

----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com