Hi,
I'm attempting to fetch all the data from an MS Access database, but every
time I try with any query it only returns every second row..
I could rows numbered from 1 to 4000 and it would return exactly 2000 rows..
I would get rows 2, 4, 6, 8, 10 ,etc..
This is the code I am using:
$dsn = "DRIVER=Microsoft Access Driver (*.mdb); DBQ=c:\\mdb\\data.mdb;";
$myDB = odbc_connect($dsn,'Admin','') or die (odbc_error());
$query = 'SELECT * FROM Hist_data';
$result = odbc_exec($myDB, $query);
$output = array();
while (odbc_fetch_row($result)){
$output[] = odbc_fetch_array($result);
}
print "Results of your query:\n\n";
print_r($output);
I tried firing up MS access and running exactly the same query, but that
functions normally and returns all the rows, so I'm assuming this is a PHP
bug..
Chris 2 1712
See below:
Skeleton Man wrote:
Hi,
I'm attempting to fetch all the data from an MS Access database, but every
time I try with any query it only returns every second row..
I could rows numbered from 1 to 4000 and it would return exactly 2000 rows..
I would get rows 2, 4, 6, 8, 10 ,etc..
This is the code I am using:
$dsn = "DRIVER=Microsoft Access Driver (*.mdb); DBQ=c:\\mdb\\data.mdb;";
$myDB = odbc_connect($dsn,'Admin','') or die (odbc_error());
$query = 'SELECT * FROM Hist_data';
$result = odbc_exec($myDB, $query);
$output = array();
------------------------------------------------------
while (odbc_fetch_row($result)){
$output[] = odbc_fetch_array($result);
}
--------------------------------------------------------
This is the offending code. Your code fetches the result twice.
you should write something like:
while($temp = odbc_fetch_array($result)) $output[] = $temp;
>
print "Results of your query:\n\n";
print_r($output);
I tried firing up MS access and running exactly the same query, but that
functions normally and returns all the rows, so I'm assuming this is a PHP
bug..
Chris
>------------------------------------------------------
>while (odbc_fetch_row($result)){ $output[] = odbc_fetch_array($result); }
-------------------------------------------------------- This is the offending code. Your code fetches the result twice. you should write something like:
>while($temp = odbc_fetch_array($result)) $output[] = $temp;
Thanks, must've been a brain fart I think ;-)
Chris This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: jarednevans |
last post by:
I need to know why MS Access/ODBC is reporting different results than
the one shown in psql.
I created a very simple function below:
------------------
CREATE OR REPLACE FUNCTION...
|
by: Roger Redford |
last post by:
Dear Experts,
I'm attempting to marry a system to an Oracle 817 datbase.
Oracle is my specialty, the back end mainly, so I don't
know much about java or javascript.
The system uses javascript...
|
by: Indiana Epilepsy and Child Neurology |
last post by:
Before asking this questions I've spent literally _years_ reading
(Meyer, Stroustrup, Holub), googling, asking more general design
questions, and just plain thinking about it. I am truly unable to...
|
by: Todd Huish |
last post by:
I have noticed something disturbing when retrieving datasets over a
relatively slow line (multiple T1). I am looking at about 25 seconds to
retrieve 500 rows via a php-odbc link. This same select...
|
by: Richard Marsden |
last post by:
(also posted to microsoft.public.access.odbcclientsvr but no reply so
far: problem concerns ODBC->MS Access)
I have some ODBC code that I'm testing against various underlying
databases. The...
|
by: Crazy Cat |
last post by:
Hi all,
I am having trouble getting linked Oracle 9 server in MS SQL Server
2005 Express to work properly. My machine is running Windows XP.
The Microsoft and Oracle OLE DB Providers have...
|
by: robertino |
last post by:
Hi all,
I've put together a few SPs to produce a BOM (bill of materials)
listing, which together use a couple of global temp tables, and return
the results from a cursor. Here's the code:
...
|
by: 2DIL |
last post by:
hello all experts,
basically, i have a very small project, in which 97% of the work is complete. yet there is an issue which i cannot solve and i have no error to indicate what the problem...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |