On Wednesday, March 6, 2002, at 12:13 PM, Kris Vose wrote:
> I have a problem with reading the contents of $r[1] into a string
> called = $mail. Does anyone have any suggestions? Any help is greatly
> appreciated.
>
> Kris Vose
>
>
> if ($czero != "")
> {
>
> $t = mysql_query("SELECT * FROM AddExisting");
$t is now a resource variable, not an array. If you want to know the
number of rows returned
use mysql_num_rows($t) not count($t)
>
> $number_of_customers = count($t);
>
> while($r = mysql_fetch_array($t))
Note: you'll loop through this section $number_of_customer times,
pulling one table row into $r
each time through.
> {
> extract($r);
Why are you using extract here?
> for ($i = 0; $i<$number_of_customers; $i++)
You're looping through $number_of_customers columns on each row in the
table. Is this what you want? Is your table really $number_of_customers
wide?
> {
> echo $r[1].", ";
Do you mean $r[$i] ?
> }
>
> }
>
Now you've dropped out of both loops. $r will be holding the last row
you retrieved from the database table.
> $mail = ' ';
> foreach($r[1] as $mailline)
$r[1] is not an array here. What are you trying to do?
> {
> $mail.=$mailline;
> }
>
> }
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php