note 49243 added to function.substr-replace

From: Date: Fri, 21 Jan 2005 07:12:31 +0000
Subject: note 49243 added to function.substr-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-83717@lists.php.net to get a copy of this message
Hi ,i use substr_replace alot for a situation with a multiple result query and for a nice out put. <?php // dataaccess $getsomevalues=mysql_query("select s.* from ".$prefix."_ecc_interests s inner join ".$prefix."_ecc_interests_lookup l on s.iid=l.iid where l.user_id='$cookie[0]' "); while ($holdingit =mysql_fetchrow($getsomevalues)) { $interestring.="".$holdingit[interests].",&nbsp;"; } // now its like valuea&nbsp;,valueb&nbsp;,valuec&nbsp;, // application logic /* chop of the last space &nbsp and the , and change it for a dot.*/ $intereststring =substr_replace($interestring,'.',-7); // design print $intereststring; ?> will return valuea, valueb, valuec. ---- Manual Page -- http://www.php.net/manual/en/function.substr-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49243 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49243&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49243&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49243&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49243&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49243&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49243&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#83717) next »