RE: sending array data using php mail

2003-12-27 Thread Abs
 --- Mike Johnson [EMAIL PROTECTED] wrote: 
 For the record, there's a syntax error in there --
 the closing curly brace is missing.
 
 echo {$row[Password]}\n;
^
 
 Also, I've never tried this syntax with
 double-quotes. Do the curly braces keep the PHP
 parser from thinking that the opening  for Password
 is a close of the string? I use single quotes in
 that kind of situation, FWIW.

yeah, my bad, the ending curly braces were missing.
when using double quotes, the curly braces are there
so that it can identify the whole variable as an array
type. yeah, it would probably mix up the meaning of
the double quotes in the array key name. even i use
single quotes for array keys, was just showing how the
syntax should be in that situation.

the manual uses  and ' quotes in just about all
contexts anyway. if the whole thing is in double
quotes then it needs curly braces anyway, regardless
of which quotes i use for the key. i haven't come
across anything specific regarding this in the
documentation. for the array stuff in strings and
filehandling, it's shown with single quotes. whereas,
in the array function examples, they use double
quotes. not using any quotes... END_OF_EXAMPLE
// Works but note that this works differently outside
string-quotes
echo A banana is $fruits[banana].;
END_OF_EXAMPLE;

so for safety, i use curly braces and single quotes.
maybe double quotes can be used when u want to use a
weird key name like: $a[all$myvars_start_with_all]
though $a['all'.$myvars_start_with_all.'EVERYWHERE']
would be clearer in that case. (uself if u're
importing variables and prefixing them with something
so that u don't need to re-write code u've written
and/or can adapt code written for register globals on
while using it when off.

just mho.

abs


Yahoo! Messenger - Communicate instantly...Ping 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: sending array data using php mail

2003-12-10 Thread Mike Johnson
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]

 Hi, can anyone tell me what is the problem of my script:
 
 $sql2 = SELECT * FROM Cash WHERE HP='$HP' and 
 SignUpDate='$SignUpDate';
$rows1 = mysql_query($sql2,$linkptr1) ;
 

$OwnnerMail =[EMAIL PROTECTED];
$Subject = Testing;
 
while ( $row = mysql_fetch_array($rows1) ) { 

$newvalue = $row[Password];  
echo $newvalue\n;


  }
$Body = $newvalue;
$From = $HP;
mail( $OwnnerMail,$Subject, $Body, From: $From);   
 
 I can see all the data for $newvalue in browser.  But, when i 
 receive email, i can only see the last data.
 
 can i know what is the problem?  thank you.


Your script is doing exactly what you told it to. After the while() loop, $newvalue is 
set to the last member of $row[Password].

Try something like this...


$sql2 = SELECT * FROM Cash WHERE HP='$HP' and SignUpDate='$SignUpDate';
$rows1 = mysql_query($sql2,$linkptr1);

$OwnnerMail =[EMAIL PROTECTED];
$Subject = Testing;
$Body = ;

while ( $row = mysql_fetch_array($rows1) ) { 

$newvalue = $row[Password];  
echo $newvalue\n;
$Body .= $newvalue\n;

}

$From = $HP;
mail( $OwnnerMail,$Subject, $Body, From: $From);   


See how $Body is initialized before the while() loop, and then appended to using .= 
inside the loop? Once the loop completes, $Body contains all values of 
$row[Password], not just the last one.



-- 
Mike Johnson
Web Developer/Systems Asst.
Smarter Living, Inc.
phone (617) 497-2500 x226

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: sending array data using php mail

2003-12-10 Thread Mike Johnson
From: Abs [mailto:[EMAIL PROTECTED]

 hi
 the error is in this line:
 $newvalue = $row[Password];
 make it
 $newvalue.= $row[Password];
 (notice  ^ the dot - for concatenation with the
 previous value).
 
 and if u want to see each password in the browser too,
 in that same loop, put:
 echo {$row[Password]\n;
 
 so it would now look like:
 while ( $row = mysql_fetch_array($rows1) ) { 
 
$newvalue.=$row[Password];  
echo {$row[Password]\n;
 }
 
 u may also want to use a br in ur echo line to make
 the browser output nicer, the \n affects only the html
 code. and while u're at it, put a \n in $newline so
 that ur email looks nicer.


For the record, there's a syntax error in there -- the closing curly brace is missing.

echo {$row[Password]}\n;
   ^

Also, I've never tried this syntax with double-quotes. Do the curly braces keep the 
PHP parser from thinking that the opening  for Password is a close of the string? I 
use single quotes in that kind of situation, FWIW.


-- 
Mike Johnson
Web Developer/Systems Asst.
Smarter Living, Inc.
phone (617) 497-2500 x226

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: sending array data using php mail

2003-12-09 Thread Abs
hi
the error is in this line:
$newvalue = $row[Password];
make it
$newvalue.= $row[Password];
(notice  ^ the dot - for concatenation with the
previous value).

and if u want to see each password in the browser too,
in that same loop, put:
echo {$row[Password]\n;

so it would now look like:
while ( $row = mysql_fetch_array($rows1) ) { 

   $newvalue.=$row[Password];  
   echo {$row[Password]\n;
}

u may also want to use a br in ur echo line to make
the browser output nicer, the \n affects only the html
code. and while u're at it, put a \n in $newline so
that ur email looks nicer.

abs


BT Yahoo! Broadband - Save £80 when you order online today. Hurry! Offer ends 21st 
December 2003. The way the internet was meant to be. 
http://uk.rd.yahoo.com/evt=21064/*http://btyahoo.yahoo.co.uk

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]