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" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]