Re: [PHP-DB] foreach()

2005-01-31 Thread graeme
or even... $z = array('foo' => array('bar'), 'dis' => array('dat')); while (list($key, $val) = each($z)) { echo "$key $val[0]"; } You need to remove the superfluous close bracket on after bar, and the val is an array hence $val[0] to get the element displayed. graeme. Han wrote: Try this : -- $z

Re: [PHP-DB] foreach()

2005-01-31 Thread graeme
try... $z = array('foo' => array('bar'), 'dis' => array('dat')); foreach($z as $key => $value) { echo "$key $value[0] "; } graeme. Yemi Obembe wrote: Hi folks. wat can be done to dis: $z = array('foo' => array('bar')), 'dis' => array('dat')); foreach(//???) { echo "//??? //?? "; } to output dis:

Re: [PHP-DB] foreach()

2005-01-31 Thread Han
Try this : -- $z = array('foo' => array('bar')), 'dis' => array('dat')); while (list($key, $val) = each($z)) { echo "$key $val"; } - Original Message - From: "Yemi Obembe" <[EMAIL PROTECTED]> To: Sent: Monday, January 31, 2005 9:47 AM Subject: [PHP-DB] foreach() Hi folks. wat can be d

Re: [PHP-DB] foreach() & db brainiacs please help?

2003-09-09 Thread jeffrey_n_Dyke
couldn't this be accomplished with a Left Join? Depending on how your tables are arranged you should be able to get all (sub)sub-names out and in the same result set using the top_name with a Left Join. any key that relates to the parent key would be returned. it looks like you have them all in

Re: [PHP-DB] foreach problem

2003-02-07 Thread Jason Wong
On Saturday 08 February 2003 06:16, Sam Folk-Williams wrote: > I don't get any MySQL error... It adds the first entry_id and date exactly > as it should... it seems to be acting like entry_date is not an array, but > when I use the same foreach loop to echo the contents of entry_date it > echoes th

Re: [PHP-DB] foreach problem

2003-02-07 Thread Sam Folk-Williams
I don't get any MySQL error... It adds the first entry_id and date exactly as it should... it seems to be acting like entry_date is not an array, but when I use the same foreach loop to echo the contents of entry_date it echoes the multiple values (2003-05-01, 2003-05-02, etc)... I use the same cod

Re: [PHP-DB] foreach problem

2003-02-07 Thread Jason Wong
On Friday 07 February 2003 11:22, Sam Folk-Williams wrote: > Hi, > > I can't figure out why this won't work: > > foreach($event_date as $val) { > > $sql2 = "INSERT INTO cal_date_map (entry_id, date) VALUES (\"$entry_id\", > \"$val\")"; > $result = @mysql_query($sql2,$connection) or die > ("Problem

Re: [PHP-DB] foreach($HTTP_POST_VARS as $key => $value)

2003-01-22 Thread Andrey Hristov
Long time ago I built a class for these needs. In fact the half of the code is *stolen* from implemenation of my colleague. I just made it OOP. The class in pi-validate.class.php.txt, the definitions of the checked fields is in pi-validate.defs.php Sample use : $validate_result = CValidate::v

RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-28 Thread Rick Widmer
At 10:40 AM 11/29/02 +1100, Gavin Amm wrote: hmm, interesting to know the mysql_fetch_array() by default returns an array that's associative AND numeric - very useful to know & something i'll have to look into more, thanks Jason. Using PHP's built in template system... $result_dept = mysql_quer

RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-28 Thread Gavin Amm
thanks John, i was thinking along similar lines. that should work well. cheers, Gav -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Friday, 29 November 2002 4:08 PM To: 'Gavin Amm'; 'Php-Db (E-mail)' Subject: RE: [PHP-DB] foreach loop from M

RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-28 Thread John W. Holmes
> hmm, interesting to know the mysql_fetch_array() by default returns an > array > that's associative AND numeric - very useful to know & something i'll have > to look into more, thanks Jason. > > Thanks also John, puting curley braces around the variables is a valuable > lesson - works wonderfull

RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-28 Thread Gavin Amm
{$row['dept']}\n"; } ?> cheers, Gav -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Friday, 29 November 2002 2:59 AM To: 'Gavin Amm'; 'Php-Db (E-mail)' Subject: RE: [PHP-DB] foreach loop from MySQL select query to HTML select l

RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-28 Thread John W. Holmes
> i've looked around the web a bit more & it would appear you can't just use > a > foreach function, apparently you need to use a while{foreach{}} structure. > i > was hoping you could just use the foreach function? > > so this is the code now: > > > -select- > while ($row = mysql_fet

Re: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-27 Thread Jason Wong
On Thursday 28 November 2002 14:21, Gavin Amm wrote: > ok, > > i've looked around the web a bit more & it would appear you can't just use > a foreach function, apparently you need to use a while{foreach{}} > structure. i was hoping you could just use the foreach function? > > so this is the code no

RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-27 Thread Gavin Amm
ok, i've looked around the web a bit more & it would appear you can't just use a foreach function, apparently you need to use a while{foreach{}} structure. i was hoping you could just use the foreach function? so this is the code now: -select- $value\n"; } } ?> but now th

RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-27 Thread Gavin Amm
002 3:44 PM To: Gavin Amm Cc: Php-Db (E-mail) Subject: Re: [PHP-DB] foreach loop from MySQL select query to HTML select list On Wed, 2002-11-27 at 23:33, Gavin Amm wrote: > Hi, > > I'm trying to pick up data from my MySQL database, use a foreach loop to > extact the data from th

Re: [PHP-DB] foreach loop from MySQL select query to HTML selectlist

2002-11-27 Thread John Coder
On Wed, 2002-11-27 at 23:33, Gavin Amm wrote: > Hi, > > I'm trying to pick up data from my MySQL database, use a foreach loop to > extact the data from the result & put that data into a select list. > > I have tried the following code with & without the $row = ... line, both > unsucessfully: > >

Re: [PHP-DB] foreach

2002-06-04 Thread James Kupernik
found my problem .. thank you for your help! You guy put me in the right direction to solve this problem. Thanks!! "Jason Wong" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Tuesday 04 June 2002 00:52, James Kupernik wrote: > > yes because I'm using it i

Re: [PHP-DB] foreach

2002-06-03 Thread Jason Wong
On Tuesday 04 June 2002 00:52, James Kupernik wrote: > yes because I'm using it in another foreach, but this one doesn't want to > work. > > > "Pierre-Alain Joye" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > On Mon, 3 Jun 2002 12:48:47 -0400 > > > > "Ja

Re: [PHP-DB] foreach

2002-06-03 Thread James Kupernik
yes because I'm using it in another foreach, but this one doesn't want to work. "Pierre-Alain Joye" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Mon, 3 Jun 2002 12:48:47 -0400 > "James Kupernik" <[EMAIL PROTECTED]> wrote: > > > > > and I'm getting this:

Re: [PHP-DB] foreach

2002-06-03 Thread Pierre-Alain Joye
On Mon, 3 Jun 2002 12:48:47 -0400 "James Kupernik" <[EMAIL PROTECTED]> wrote: > > and I'm getting this: > Warning: Invalid argument supplied for foreach() > > Why is that? are you sure $cart is an array ? pa -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www