RE: [PHP-DB] Help Me Fix My User Defined Funtion
| From: | Mark Roedel | Date: | Thu, 19 Apr 2001 19:03:15 +0000 |
| Subject: | RE: [PHP-DB] Help Me Fix My User Defined Funtion | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-8728@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: SOHH.com Webmaster [mailto:webmaster@sohh.com]
> Sent: Thursday, April 19, 2001 4:45 PM
> To: Mark Roedel
> Cc: php-db@lists.php.net
> Subject: RE: [PHP-DB] Help Me Fix My User Defined Funtion
>
>
> However, since posting my question, I have solved it by doing
> the following:
>
> <?php
> while($row_listbyreads = mysql_fetch_array($result_listbyreads)) {
> $sectionID = $row_listbyreads["sectionID"];
> $contentcount = $row_listbyreads["contentcount"];
> $contentheadline =
> stripslashes($row_listbyreads["contentheadline"]);
> $contentID = $row_listbyreads["contentID"];
>
> ?>
> <tr>
> <td><a href="<?php echo generatesectionlink($sectionID,$contentID);
> ?>"><?php echo $contentheadline; ?></a></td>
> <td><?php echo $contentcount; ?></td>
> </tr>
> <?
> }
> ?>
>
> Which works but what if I wanted to use the results to do
> something else? Like take the string ($link) and count the
> lenght of it (just an example).
You can keep calling the function every time you need the value
$stringlength =
strlen(generatesectionlink($sectionID,$contentID);
OR
you could just assign the return-value of the function to a variable and
use that for the remainder of that run through the loop.
$thislink = generatesectionlink($sectionID,$contentID);
$linklength = strlen($thislink);
echo $thislink;
---
Mark Roedel | "The most overlooked advantage to owning a
Systems Programmer | computer is that if they foul up there's no
LeTourneau University | law against whacking them around a little."
Longview, Texas, USA | -- Owen Porterfield