Re: [PHP] Please Help with LOOP!! - Questions Answered!!!

2002-07-18 Thread Wee Keat

THANK YOU S MUCH FOR ALL YOUR HELP!!

God... in just five minutes you guys have helped me solved a problem I've
tried to figure out in an hour!!!

I finally decided to take off the loop and used only the while loop it
WORKED beautifully!

Thank you s much Lejanson, Asmodean, Martin and Dave. and all who
helped.

Really really appreciate it.

KISS TO ALL OF YAS!!!



- Original Message -
From: "Martin Towell" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Friday, July 19, 2002 10:46 AM
Subject: RE: [PHP] Please Help with LOOP!!


> Asmodean - using comma is another way of using echo...
>
> Wee - try this instead - you're putting two loops together when you don't
> need to
>
> for($count=1; $count<=$rows; $count++)
> {
>   $query_data = mysql_fetch_array($result);
>   $price = $query_data["price_lq"];
>   $RowColor = useColor();
>   // current echo statements here
> }
>
> or
>
> $count=1;
> while($query_data = mysql_fetch_array($result))
> {
>   $price = $query_data["price_lq"];
>   $RowColor = useColor();
>   // current echo statements here
> }
> $count++;
>
> -----Original Message-
> From: Asmodean [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 19, 2002 10:48 AM
> To: PHP General
> Subject: Re: [PHP] Please Help with LOOP!!
>
>
> Hello Wee,
>
> Friday, July 19, 2002, 2:36:40 AM, you wrote:
>
> WK> Hi all...
>
> WK> I'm a complete beginner in programming. Just started a few months ago.
>
> WK> So, I'm sorry if this is a stupid question to ask. But I'm at a dead
end
> here and do not know where else to go.
>
> WK> I'm trying to automate a checkbox name to have the name "choice1" to
> have incremental effect on the number such as the following:
>
> WK> 
> WK> 
> WK> 
> WK> ...
>
> WK> And I used the following script (please don't laugh) :)
>
> WK> Maximise this email to full screen so that you can see the script
> better.
>
> WK> for($count=1; $count<=$rows; $count++) {
> WK>while($query_data = mysql_fetch_array($result)) {
> WK> $price = $query_data["price_lq"];
> WK> $RowColor = useColor();
> WK> echo "\n";
> WK> echo " face=\"Arial, Helvetica,
> sans-serif\">",$query_data["prod_brand"],"";
> WK> echo " face=\"Arial, Helvetica,
> sans-serif\">",$query_data["prod_desc"],"";
> WK> echo " Helvetica, sans-serif\">","$",$price,"";
> WK> echo " name=\"choice",$count,"\" value=\"",
> $query_data["prod_id"],"\">\n";
> WK>}
> WK> }
>
> WK> The result was irritating... it came up with the same name, which is
> "choice1" all the way like:
>
> WK> 
> WK> 
> WK> 
> WK> ...
>
> WK> Am I doing it the wrong way? If so, how should I do it?
>
> WK> Please pleas help... thanks
>
> WK> Yours,
> WK> Wee Keat
>
> WK> 
> WK> "Good timber does not grow with ease; the stronger the wind, the
> stronger the trees."
>
> echo " name=\"choice",$count,"\" value=\"",
> $query_data["prod_id"],"\">\n";
>
> Your problem is with this line. Look closely at the following part:
>
> name=\"choice",$count,"\"
>
> You should do this:
>
> name=\"choice" . $count . "\"
>
> ... and it will generate names like 'choice1', 'choice2', and so on.
>
> --
> Best regards,
>  Asmodeanmailto:[EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Please Help with LOOP!!

2002-07-18 Thread Jerome Houston

martin-
you're totally right except for one thing

>$count=1;
>while($query_data = mysql_fetch_array($result))
>{
>   $price = $query_data["price_lq"];
>   $RowColor = useColor();
>   // current echo statements here
>}
>$count++;

this code will give him the exact same problem.  the

$count++;

line needs to be *inside* the while loop.  probably a typing mistake on your 
part, but i didn't want this guy to get help that ended him up with the same 
problem =).


-jerome


_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Please Help with LOOP!!

2002-07-18 Thread Martin Towell

Asmodean - using comma is another way of using echo...

Wee - try this instead - you're putting two loops together when you don't
need to

for($count=1; $count<=$rows; $count++)
{
  $query_data = mysql_fetch_array($result);
  $price = $query_data["price_lq"];
  $RowColor = useColor();
  // current echo statements here
}

or

$count=1;
while($query_data = mysql_fetch_array($result))
{
  $price = $query_data["price_lq"];
  $RowColor = useColor();
  // current echo statements here
}
$count++;

-Original Message-
From: Asmodean [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 19, 2002 10:48 AM
To: PHP General
Subject: Re: [PHP] Please Help with LOOP!!


Hello Wee,

Friday, July 19, 2002, 2:36:40 AM, you wrote:

WK> Hi all...

WK> I'm a complete beginner in programming. Just started a few months ago. 

WK> So, I'm sorry if this is a stupid question to ask. But I'm at a dead end
here and do not know where else to go.

WK> I'm trying to automate a checkbox name to have the name "choice1" to
have incremental effect on the number such as the following:

WK> 
WK> 
WK> 
WK> ...

WK> And I used the following script (please don't laugh) :)

WK> Maximise this email to full screen so that you can see the script
better.

WK> for($count=1; $count<=$rows; $count++) {
WK>while($query_data = mysql_fetch_array($result)) {
WK> $price = $query_data["price_lq"];
WK> $RowColor = useColor();
WK> echo "\n";
WK> echo "",$query_data["prod_brand"],"";
WK> echo "",$query_data["prod_desc"],"";
WK> echo "","$",$price,"";
WK> echo "\n";
WK>}
WK> }

WK> The result was irritating... it came up with the same name, which is
"choice1" all the way like:

WK> 
WK> 
WK> 
WK> ...

WK> Am I doing it the wrong way? If so, how should I do it? 

WK> Please pleas help... thanks

WK> Yours,
WK> Wee Keat

WK> 
WK> "Good timber does not grow with ease; the stronger the wind, the
stronger the trees."

echo "\n";

Your problem is with this line. Look closely at the following part:

name=\"choice",$count,"\"

You should do this:

name=\"choice" . $count . "\"

... and it will generate names like 'choice1', 'choice2', and so on.

-- 
Best regards,
 Asmodeanmailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Please Help with LOOP!!

2002-07-18 Thread Asmodean

Hello Wee,

Friday, July 19, 2002, 2:36:40 AM, you wrote:

WK> Hi all...

WK> I'm a complete beginner in programming. Just started a few months ago. 

WK> So, I'm sorry if this is a stupid question to ask. But I'm at a dead end here and 
do not know where else to go.

WK> I'm trying to automate a checkbox name to have the name "choice1" to have 
incremental effect on the number such as the following:

WK> 
WK> 
WK> 
WK> ...

WK> And I used the following script (please don't laugh) :)

WK> Maximise this email to full screen so that you can see the script better.

WK> for($count=1; $count<=$rows; $count++) {
WK>while($query_data = mysql_fetch_array($result)) {
WK> $price = $query_data["price_lq"];
WK> $RowColor = useColor();
WK> echo "\n";
WK> echo "",$query_data["prod_brand"],"";
WK> echo "",$query_data["prod_desc"],"";
WK> echo "","$",$price,"";
WK> echo "\n";
WK>}
WK> }

WK> The result was irritating... it came up with the same name, which is "choice1" all 
the way like:

WK> 
WK> 
WK> 
WK> ...

WK> Am I doing it the wrong way? If so, how should I do it? 

WK> Please pleas help... thanks

WK> Yours,
WK> Wee Keat

WK> 
WK> "Good timber does not grow with ease; the stronger the wind, the stronger the 
trees."

echo "\n";

Your problem is with this line. Look closely at the following part:

name=\"choice",$count,"\"

You should do this:

name=\"choice" . $count . "\"

... and it will generate names like 'choice1', 'choice2', and so on.

-- 
Best regards,
 Asmodeanmailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php