Pagination in PHP & MS Access

  • (2 Pages)
  • +
  • 1
  • 2

22 Replies - 9370 Views - Last Post: 06 June 2005 - 04:19 PM Rate Topic: -----

#16 bexlhoward1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 40
  • Joined: 04-February 05

Re: Pagination in PHP & MS Access

Posted 05 June 2005 - 09:22 AM

If i try to use that then i get the error : mysql_num_rows(): supplied argument is not a valid MySQL result resource.

The reason I was using COUNT is because I am using Access not MySQL. I think this is the reason I am getting the error if I try using mysql_num_rows.
Was This Post Helpful? 0
  • +
  • -

#17 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1876
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Pagination in PHP & MS Access

Posted 05 June 2005 - 09:48 AM

Arrrg, I'm sorry:

http://us4.php.net/m...bc-num-rows.php

That work??
Was This Post Helpful? 0
  • +
  • -

#18 bexlhoward1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 40
  • Joined: 04-February 05

Re: Pagination in PHP & MS Access

Posted 05 June 2005 - 10:04 AM

I dont think so as I am using ADODB. I have tried PO_Rowcount but I cannot get that to work either.
Was This Post Helpful? 0
  • +
  • -

#19 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Pagination in PHP & MS Access

Posted 05 June 2005 - 11:24 AM

$rs2 is a recordset...you'll have to access the correct member. Try modifying your count query to something like
$resultcount = "SELECT COUNT(propertyID) as totalcount FROM property WHERE propertytype = '".$propertyrequired."' AND area='".$area."' AND bedrooms = '".$bedrooms."' AND price <= '".$budget."' ORDER BY '".$address3."'";


Once the results of that query have been assigned to $rs2, access the $rs2("totalcount") field. Also, you should just be able to use COUNT(*) unless you're trying to do something else with propertyID.
Was This Post Helpful? 0
  • +
  • -

#20 bexlhoward1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 40
  • Joined: 04-February 05

Re: Pagination in PHP & MS Access

Posted 06 June 2005 - 03:00 PM

Hi, I have tried this and I get the error: "Call to undefined function". The code I used is:

$resultcount = "SELECT COUNT(*) as totalcount FROM property WHERE propertytype = '".$propertyrequired."' AND area='".$area."' AND bedrooms = '".$bedrooms."' AND price <= '".$budget."' ORDER BY '".$address3."'";

$finalrowcount=$rs2("totalcount");

print"$finalrowcount"; 


Am I trying to access it wrongly?

Thanks.
Was This Post Helpful? 0
  • +
  • -

#21 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Pagination in PHP & MS Access

Posted 06 June 2005 - 03:14 PM

$rs['totalcount']

my bad, when I was typing it, it was meant as an example of the property, not the real syntax.

Or even $rs->Fields[0]->Value
Was This Post Helpful? 0
  • +
  • -

#22 bexlhoward1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 40
  • Joined: 04-February 05

Re: Pagination in PHP & MS Access

Posted 06 June 2005 - 03:42 PM

Hi, thank you so much. $finalrowcount=$rs->Fields[0]->Value; worked however accessing it using $finalrowcount=$rs['totalcount'] would not.

Back to the final question however (one solution at a time :-) ), I have data in the $rs array, is it best to call the first 10 results from the array rather than the SQL for the pagination? If so, should the SQL just call the IDs so they are stored in the array and then connect to the database again to pull out the results based on the IDs in the array?

If that makes sence?

Thanks.
Was This Post Helpful? 0
  • +
  • -

#23 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1876
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Pagination in PHP & MS Access

Posted 06 June 2005 - 04:19 PM

Lately, I've been using the last method... depending on the number of records it may be quicker to just run a bunch of little queries, rather than trying to store and loop through 300+ records.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2