Re: Result problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



   Are you trying to just print this to the screen?  If so, refer to the
modified snippet I sent you a bit ago.


On 4/25/07, Dan Shirah <mrsquash2@xxxxxxxxx> wrote:

I'm sorry, perhaps I confused everyone by including the print_r.

My table has 79 records all with a status_code of 'P' that this "should"
be
returning.  But instead of all the results returning, all I am getting
back
is row 79.



On 4/25/07, Richard Lynch <ceo@xxxxxxxxx> wrote:
>
> On Wed, April 25, 2007 3:56 pm, Dan Shirah wrote:
> > Any ideas why my query only returns the very last record that matches
> > the
> > criteria specified??
> >
> > $sql_record ="SELECT * FROM payment_request WHERE status_code = 'P'";
> > $result_record = mssql_query($sql_record) or die(mssql_error());
> >   if(!empty($result_record)) {
> >   while ($row_record = mssql_fetch_array($result_record)) {
> >      $id_record = $row_record['id'];
> >    }
> >   }
> >   print_r ($sql_record);
> >
> > The result of the print_r displays only the last record that matches
> > the
> > query criteria.  I tried a foreach instead of a while with no luck.
>
> You do the 'print_r' *AFTER* you've run through all the records.
>
> Move that line *INSIDE* the loop, and it will print each one as it
> goes through.
>
> This will be more clear if you indent better, though that may just be
> email messing up, not your real code.
>
> Every time you type a '{', indent by one tab.
> Stay indented until you type a '}'
>
> The "flow" of the program is then seen by skimming with the eyes
> downward on the left side, and the 'print_r' being outside the loop
> will be more obvious, with practice.
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>
>




--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux