RE: [PHP-WIN] Re: Rows of data all the same
| From: | HKG) | Date: | Thu, 10 Oct 2002 12:13:55 +0000 |
| Subject: | RE: [PHP-WIN] Re: Rows of data all the same | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16315@lists.php.net to get a copy of this message | ||
How did you do loop? Did you do something like this:
$result = mssql_query($query);
while (@line = mssql_fetch_row($result)) {
print "$line[0], @line[1], @line[3]\n";
}
> -----Original Message-----
> From: Douglas F. Keim [mailto:keimdf@softek-net.com]
> Sent: Thursday, October 10, 2002 1:18 PM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Re: Rows of data all the same
>
>
> This is an update on this problem. Direct SQL commands are working just
> fine with the query, but as soon as I use the php commands it get these
> results. I have tried stepping through the rows with various odbc commands
> with similar results. Now I am suspecting that the $Results are only
> getting the first record in the table three times since there are three
> records in the table.
>
> I have tried while statements, odbc_fetch_row, next ... the list goes on.
> All I have accomplished if seeing the whole of or parts of the same record
> each time.
>
> I just don't think the query is working in php. And if so, I don't know how
> to verify that.
>
> Any suggestions?
>
> "Douglas F. Keim" <keimdf@softek-net.com> wrote in message
> news:20021009142413.18412.qmail@pb1.pair.com...
> > I have this query that I performing on the database.
> >
> > Unfortunately, it is returning all the same information for all rows.
> >
> > The table has three rows of data in it
> > Tbl_ID Tbl_Name Tbl_Age
> > 1 Horse 21
> > 2 Cow 30
> > 3 Eagle 14
> >
> > My php script looks like this.
> > $TableName = "PUB.table1";
> > $Link = odbc_connect ($DBName,$User,$Password);
> > $Query = "SELECT * from $TableName";
> > $Results = odbc_do($Link, $Query);
> > print odbc_result_all($Results);
> >
> > My browser results are as follows ...
> > Tbl_ID Tbl_Name Tbl_Age
> > 1 Horse 21
> > 1 Horse 21
> > 1 Horse 21
> >
> >
> > I am not sure what I am doing wrong here.