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.
22 Replies - 8495 Views - Last Post: 06 June 2005 - 04:19 PM
#17
Re: Pagination in PHP & MS Access
Posted 05 June 2005 - 09:48 AM
#18
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.
#19
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
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.
$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.
#20
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:
Am I trying to access it wrongly?
Thanks.
$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.
#21
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
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
#22
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.
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.
#23
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.
|
|

New Topic/Question
Reply




MultiQuote



|