Forums
This topic is locked
PHP show n lefcharacters from record in recordset.
Posted 21 Dec 2005 20:12:15
1
has voted
21 Dec 2005 20:12:15 Chris Gates posted:
Hi Peeps,Having a bit of chew with displaying n amount of characters from a record in a recordset.
I have a couple of recordsets on the page and I know the bit of code should be simple but I can't for the life of me work it out or find it on tinterweb
On one record set i have
<?php echo $row_Interview['LEFT(interview.interview, 200)']; ?>
this quite happily displays the first 200 characters for that record but won't display anything if I change the amount of characters.
I have tried it on another recordset record
<?php echo $row_happenings['text']; ?>
When I try and add any of the LEFT bits and bobs it doesn't display anything.
Any help withthis would be wicked!
Cheers
CJ
Replies
Replied 22 Dec 2005 14:32:36
22 Dec 2005 14:32:36 Roddy Dairion replied:
try this instead
<?php
echo substr($row_interview['interview'],0,200);
?>
it will have the same effect the hte LEFT function in MySQL. It will take the first 200 characters and display it.
Hope it helps.
Roddy.
<?php
echo substr($row_interview['interview'],0,200);
?>
it will have the same effect the hte LEFT function in MySQL. It will take the first 200 characters and display it.
Hope it helps.
Roddy.