Re: double values in array

From: Date: Wed, 12 Sep 2001 23:37:00 +0000
Subject: Re: double values in array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-67101@lists.php.net to get a copy of this message
Hi Tom. First check to see what $y looks like: print "<pre>"; print_r($y); print "</pre>"; Then you'll see the whole array. I'm guessing your mysql_fetch_array() is returning the id twice. What does your query look like. Also, you can use the foreach but I don't think the while is the problem: $y = mysql_fetch_array ($getrec_result); foreach($y as $key => $value) { $body .= "$key: $value\n"; } "Tom Beidler" <tom@orbittechservices.com> wrote in message news:B7C528B1.2C35%tom@orbittechservices.com... > I have a form that I would like to send an email once it's validated. I'm > using the following code that builds the body of the email. > > $y = mysql_fetch_array ($getrec_result); > > while (list($key,$value) = each($y)) { > $body .= "$key: $value\n"; > } > > My body looks like this > > 0: 3 > id: 3 > 1: 2001-09-12 > date_add: 2001-09-12 > 2: Computer Science > dept: Computer Science > > When I really want > > id: 3 > date_add: 2001-09-12 > dept: Computer Science > > What am I doing wrong? > > Thanks, > Tom >

« previous php.general (#67101) next »