Question
Storing and displaying arrays
I am using PHP and MySQL and would be grateful for some help
on the following:
I have a recordset which display selected information from within my db, I want to be able to split a memo field so that on initial view of the page only the first 100 characters are displayed. I then want to provide a link which will dynamically extend the record in questions memo field to its fullest. I have thanks to previous help worked out how to split the field (code below) and successfully display only the first hundred characters. I understand that I simply need to call the remainder of the array to display the entire field.
Can someone please help on this?
Many thanks
Luke
=== code =======
<?php function splitMemo($memo)
{
$retVal = array();
// find first space after 100 characters
$pos = strpos($memo, ' ', 100);
// extract first and second halves
$retVal[0] = substr($memo, 0, $pos);
$retVal[1] = substr($memo, $pos+1);
// return array of both halves
return $retVal;
}
$parts = splitMemo($row_HP['Description']);
;
echo $parts[0]
?>
I have a recordset which display selected information from within my db, I want to be able to split a memo field so that on initial view of the page only the first 100 characters are displayed. I then want to provide a link which will dynamically extend the record in questions memo field to its fullest. I have thanks to previous help worked out how to split the field (code below) and successfully display only the first hundred characters. I understand that I simply need to call the remainder of the array to display the entire field.
Can someone please help on this?
Many thanks
Luke
=== code =======
<?php function splitMemo($memo)
{
$retVal = array();
// find first space after 100 characters
$pos = strpos($memo, ' ', 100);
// extract first and second halves
$retVal[0] = substr($memo, 0, $pos);
$retVal[1] = substr($memo, $pos+1);
// return array of both halves
return $retVal;
}
$parts = splitMemo($row_HP['Description']);
;
echo $parts[0]
?>
