Re: Rows of data all the same
| From: | Douglas F. Keim | Date: | Fri, 11 Oct 2002 11:43:45 +0000 |
| Subject: | Re: Rows of data all the same | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16336@lists.php.net to get a copy of this message | ||
Hi, Thanks for your input. I have an interesting situation occurring. I
believe that the problem lies in the query. And in the fact that this is
odbc to a Progress database. Just for giggles, I created an identical
MSAccess database and set it up for ODBC. I switched the php script to look
at it and all of my querys and yours worked just fine.
Progress comes with a SQL user interface as part of their package. When I
use it, the results are just fine. I suspect that the problem here is the
ODBC drivers for Progress. I will try to go after it from that point. At
least I know that my php script and yours worked on a odbc connected
database.
Thanks again.
This is not solved but at least I have a direction to investigate.
"Uttam" <uttam@lml.co.in> wrote in message
news:97FB62E1E350D511B71F00A0C99D0CC30352CE63@lmlknp.lmllimited.com...
> i was also having trouble with odbc/access, may be my function can work
for
> you too:
> try this code:
>
> <?
> $TableName = "PUB.table1";
> $Link = odbc_connect ($DBName,$User,$Password);
> $Query = "SELECT * from $TableName";
> $Results = odbc_do($Link, $Query);
> odbctable($Results);
>
> function odbctable($result) {
> echo "<table border=1 cellspacing=0><tr>";
> $numfields=odbc_num_fields($result);
> for ($i=1;$i<=$numfields;$i++) {
> echo "<td>".odbc_field_name($result,$i)."</td>";
> }
> echo "</tr>";
> while (odbc_fetch_into($result,$row)) {
> echo "<tr>";
> for ($i=0;$i<$numfields;$i++) {
> echo "<td>$row[$i]</td>";
> }
> echo "</tr>";
> }
> echo "</table>";
> }
>
> ?>
>
> regds,
> -----Original Message-----
> From: Douglas F. Keim [mailto:keimdf@softek-net.com]
> Sent: Thursday, October 10, 2002 16:48
> To: php-windows@lists.php.net
> Subject: 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.
> >
> >
>
>
>