/    Sign up×
Community /Pin to ProfileBookmark

Paginating data from MSaccess in PHP

Hi All,

Many of you may be aware there microsoft access does not support LIMIT in queries.

I have msaccess database table that has around 82000 records.I need to paginate these records.

Could anyone help me to write a query that would suffice the same.

Regards,
Santhosh

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJun 30.2010 — From the DB side, the only thing I know of is the TOP command in MS Access, which is more or less the same as LIMIT, but it does not appear to have a corollary to OFFSET. Other than porting it over to a "real" DBMS ( ? ), all I can think of is to query all, perhaps using TOP to stop it after it would get all that page's records (essentially the TOP value would be LIMIT [i]plus[/i] OFFSET), then if the PHP DB extension you're using has some sort of record seek function, use that to jump to the "offset" result row, otherwise do a loop with a counter on the results, skipping each until the counter reaches the desired offset (which seems pretty ugly if you will be dealing with lots of matching rows in the DB query).
Copy linkTweet thisAlerts:
@sohguanhJul 01.2010 — Many of you may be aware there microsoft access does not support LIMIT in queries.

I have msaccess database table that has around 82000 records.I need to paginate these records.

Could anyone help me to write a query that would suffice the same.
[/QUOTE]


The reason why vendors are selling their enterprise databases over desktop databases is when data-set get big and performance concern creep in, their product is "touted" to offer some features over those desktop database.

In your case, you seem to have hit one of them with M$ Access. You can only do what NogDog suggested but basically I think it will still have performance problem.
Copy linkTweet thisAlerts:
@palansanthuauthorJul 01.2010 — The scenario is like , I would be receiving msaccess database every month and i will have to setup a automated php script that would read data from this access database and push the data into our "real" dbms ? thats MySQL

For this I am using windows machine and php odbc driver.

Due to large size of the database ..php throws following error :

"Allowed memory size of 134217728 bytes exhausted (tried to allocate 133169139 bytes"

I know that we can increase allowed memory size using "ini_set" but the msaccess database size will keeps increasing every month. So i am planning to read few records and in a loop and keep pushing them to mysql.

P.S. : Our partner is not ready to give the database in any other format.Not even in CSV.
Copy linkTweet thisAlerts:
@NogDogJul 01.2010 — To copy from Access to MySQL, would something like this work, do you think? (I don't have Access to try it.)
<i>
</i>SELECT TOP 100 * FROM table;

Process those 100 records into the MySQL DB, then:
<i>
</i>DELETE TOP 100 FROM table;

Reiterate until all Access records have been processed in groups of 100 (or whatever increment you prefer).
Copy linkTweet thisAlerts:
@palansanthuauthorJul 01.2010 — hmmmm, I will give it a try... and let u knw the result ?
×

Success!

Help @palansanthu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...