RE: [PHP] using a for loop but it is not working how come

From: Date: Fri, 06 Jun 2003 04:38:43 +0000
Subject: RE: [PHP] using a for loop but it is not working how come
Groups: php.general 
Request: Send a blank email to php-general+get-150449@lists.php.net to get a copy of this message
try changing $numbers = array($numbers); to $numbers = explode(",", $numbers); HTH Martin -----Original Message----- From: Richard Kurth [mailto:rdkurth@starband.net] Sent: Friday, June 06, 2003 2:42 PM To: php-general@lists.php.net Subject: [PHP] using a for loop but it is not working how come I am having a problem with this script It pulls a list of numbers from one field in the database (the numbers are in this format (275,277,278,276) It needs to pull each number and run it through the function dofunction and then move on to the next one in tell there are no more to process. What am I doing wrong or is there a better way to do this. sql="Select Numbers from dom where name = '$name'"; $results=safe_query($sql); $DBRow = mysql_fetch_array($results); $numbers = $DBRow["Numbers"]; $numbers = array($numbers); for($i = 0; $i < count($numbers); $i++){ $number = $numbers[$i]; dofunction($number); } -- Best regards, Richard mailto:rdkurth@starband.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#150449) next »