Forums
This topic is locked
limit funciton
Posted 02 Apr 2002 09:54:09
1
has voted
02 Apr 2002 09:54:09 enquest enquest1 posted:
How would you limit a text size. For example you have a tekst of 1000 words but only want to disply the first 100 and give the poss. to click on more.Is there a function?
Replies
Replied 02 Apr 2002 10:21:12
02 Apr 2002 10:21:12 Bruno Mairlot replied:
Hi Enquest !
Use the function substr($yoursstring,0,100) which will give you the 100 first character of your 1000-long string.
For more info look at :www.php.net/substr
Bruno
--- Better to die trying, than never try at all ---
Use the function substr($yoursstring,0,100) which will give you the 100 first character of your 1000-long string.
For more info look at :www.php.net/substr
Bruno
--- Better to die trying, than never try at all ---
Replied 02 Apr 2002 11:14:02
02 Apr 2002 11:14:02 enquest enquest1 replied:
Aha thats the one I was searchin thanks!
Replied 12 Apr 2002 15:10:27
12 Apr 2002 15:10:27 enquest enquest1 replied:
An easier way to do this is using the mysql query
and put something like
SELECT field, SUBSTRING_INDEX(field, '.', 2) AS fieldname
FROM table_name
Would there be an argument against this?
Anyway thanxs for the help...
Just learning slowly
and put something like
SELECT field, SUBSTRING_INDEX(field, '.', 2) AS fieldname
FROM table_name
Would there be an argument against this?
Anyway thanxs for the help...
Just learning slowly
Replied 12 Apr 2002 15:12:28
12 Apr 2002 15:12:28 enquest enquest1 replied:
(Always forget to say something. sorry for that)
Its easier because it stops at a sentence and not in the middle of a word. Also possible to select it on words ' ' counting the spaces...
Its easier because it stops at a sentence and not in the middle of a word. Also possible to select it on words ' ' counting the spaces...
Replied 20 Oct 2002 20:52:15
20 Oct 2002 20:52:15 Frank tedtofston replied:
I'm using php and mx and would like to crop a sentence. Does anyone know how to change the code below so that it will display the first 100 characters.
<?php echo $Recordset1->Fields ('db_field'); ?>
<?php echo $Recordset1->Fields ('db_field'); ?>
Replied 21 Oct 2002 12:44:03
21 Oct 2002 12:44:03 Aurel Sorin Cirstoiu replied:
Hello,
You can use the first method presented in this thread :
substr($Recordset1->Fields ('db_field'),0,100)
<?php echo substr($Recordset1->Fields ('db_field'),0,100); ?>
-----------------------
Cirstoiu Aurel Sorin
InterAKT Support
www.interakt.ro
-----------------------
You can use the first method presented in this thread :
substr($Recordset1->Fields ('db_field'),0,100)
<?php echo substr($Recordset1->Fields ('db_field'),0,100); ?>
-----------------------
Cirstoiu Aurel Sorin
InterAKT Support
www.interakt.ro
-----------------------