That's too easy!

Chris

Romulo Roberto Pereira wrote:

> Even better,
>
> $id[] = $myrow["id"];
>
> then count them:
>
> for ($i=0;$i < count($id);$i++) {
> ..
> }
>
> Rom
> -----Original Message-----
> From: Chris Fry [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 17, 2001 3:00 AM
> To: Mark Maggelet
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] baffled :<:<
>
> This loop will only return the last record from the db as the variables are
> getting overwritten each time through the loop. It would make more sense to
> make each variable an array eg:
>
> $id[$i] = $myrow["id"];
>
> or do something with each set of info inside the loop.
>
> Chris
>
> Mark Maggelet wrote:
>
> > On Tue, 17 Apr 2001 15:59:37 +1000, Peter Houchin
> > ([EMAIL PROTECTED]) wrote:
> > >can any one see a problem with this loop?
> > >
> > >  <?
> > >$db = include"connect.inc";
> > >$foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card";
> > >
> > > $result = mysql_query($foo,$db);
> > >
> > >
> > >while ( ($myrow = mysql_fetch_array($result) ) ) {
> > >
> > >$id = $myrow["id"];
> > >$card = $myrow["card"];
> > >$serial = $myrow["serial"];
> > >$avail = $myrow["avail"];
> > >$pn = $myrow["pn"];
> > >$cat = $myrow["cat"];
> > >$box = $myrow["box"];
> > >$quote = $myrow["quote"];
> > >}
> > >?>
> > >
> > >if i call say just $card it only displays the one record (the last
> > >one)
> >
> > if you call it after the loop you mean? thats what i would expect to
> > be there.
> >
> > >the minute i try to call $myrow["card"]; i get nothing at
> > >all... any idea's?
> >
> > outside the loop again? well if the last call to mysql_fetch_array()
> > returns false, then that sounds right too. you probably mean to do
> > something inside the loop. here's another tip, use extract:
> >
> > while ( ($myrow = mysql_fetch_array($result) ) ) {
> >   extract($myrow);
> >   echo $card."<br>\n";
> > }
> >
> > >I have script identical to this that works perfectly .. only
> > >difference is this one has different names for the values
> > >
> > >Peter Houchin
> > >[EMAIL PROTECTED]
> > >=========================================================
> > >     _____                              __   /\
> > >    /_/_/_\                            /  |_/  \
> > >   /_/_/_    __  __  __   __          /         \
> > >   \_/_/_\  /_/ /_/ /_/  /_/          \   _     /
> > > ___\_\_\/ /_/_/_/ /_//\/_/            \_/ \/\_/
> > > \_//_/_/ /_/_/_/ /_/ \/_/                    v
> > >     ________   ________________________________________
> > >    /_/_/_/_/  /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
> > >   /_/_ _/_/ ______  __   __  /_/ ____      __     ______
> > >  /_/_/_/_/ /_/_/_/ /_/  /_/ /_/ /_/\_\    /_/    /_/_/_/
> > > /_/  \_\  /_/ _/  /_//\/_/ /_/ /_/__\_\  /_/___ _\_\_\
> > >/_/    \_\/_/_/_/ /_/ \/_/ /_/ /_/    \_\/_/_/_//_/_/_/
> > >=========================================================
> > >Telephone : (03) 9329 1455  Facsimile : (03) 9329 6755
> > >************* We rent the dot in .COM!  **************
> > >
> >
> > --
> > 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]
>
> --
> Chris Fry
> Quillsoft Pty Ltd
> Specialists in Secure Internet Services and E-Commerce Solutions
> 10 Gray Street
> Kogarah
> NSW  2217
> Australia
>
> Phone: +61 2 9553 1691
> Fax: +61 2 9553 1692
> Mobile: 0419 414 323
> eMail: [EMAIL PROTECTED]
> http://www.quillsoft.com.au
>
> You can download our Public CA Certificate from:-
> https://ca.secureanywhere.com/htdocs/cacert.crt
>
> **********************************************************************
>
> This information contains confidential information intended only for
> the use of the authorised recipient.  If you are not an authorised
> recipient of this e-mail, please contact Quillsoft Pty Ltd by return
> e-mail.
> In this case, you should not read, print, re-transmit, store or act
> in reliance on this e-mail or any attachments, and should destroy all
> copies of them.
> This e-mail and any attachments may also contain copyright material
> belonging to Quillsoft Pty Ltd.
> The views expressed in this e-mail or attachments are the views of
> the author and not the views of Quillsoft Pty Ltd.
> You should only deal with the material contained in this e-mail if
> you are authorised to do so.
>
> This notice should not be removed.
>
> --
> 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]
>
> --
> 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]

--
Chris Fry
Quillsoft Pty Ltd
Specialists in Secure Internet Services and E-Commerce Solutions
10 Gray Street
Kogarah
NSW  2217
Australia

Phone: +61 2 9553 1691
Fax: +61 2 9553 1692
Mobile: 0419 414 323
eMail: [EMAIL PROTECTED]
http://www.quillsoft.com.au

You can download our Public CA Certificate from:-
https://ca.secureanywhere.com/htdocs/cacert.crt

**********************************************************************

This information contains confidential information intended only for
the use of the authorised recipient.  If you are not an authorised
recipient of this e-mail, please contact Quillsoft Pty Ltd by return
e-mail.
In this case, you should not read, print, re-transmit, store or act
in reliance on this e-mail or any attachments, and should destroy all
copies of them.
This e-mail and any attachments may also contain copyright material
belonging to Quillsoft Pty Ltd.
The views expressed in this e-mail or attachments are the views of
the author and not the views of Quillsoft Pty Ltd.
You should only deal with the material contained in this e-mail if
you are authorised to do so.

This notice should not be removed.



-- 
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]

Reply via email to