Closed Thread Icon

Topic awaiting preservation: SelectLimit Php (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=13010" title="Pages that link to Topic awaiting preservation: SelectLimit Php (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: SelectLimit Php <span class="small">(Page 1 of 1)</span>\

 
H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 12-01-2003 08:15

Hey all, been trying this out all day and its starting to get to me! I'm trying to use a database to show the last 10 recorrds from a set, then have next page etc to show the next 10.

I've been looking it up and it seems a way to do this is with the SelectLimit thing. Now im using a MS Access database, i can get it all working until i try limit the records, at which point its gives me an error that it couldnt successfully open the database how i wanted. From what i've looked up i should be able to do this:

$sql="SELECT * FROM Reviews WHERE type = '$category'";
$dbRead= &$dbConn->SelectLimit($sql, 3, 2)

Which should mean it will select the 3 records starting at record 2. Now when i run my php it gives me an error:

Description: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. in

I've looked it up and its used in heaps of examples yet it just wont work for me, i was previously accessing my databases with:

$dbRead= $dbConn->Execute("SELECT * FROM Reviews");


Is there any reason why this wouldnt work, or is there a better way to do it, its really starting to bug me ;(

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 12-01-2003 09:52

Never used that one, but found this: http://phplens.com/adodb/reference.functions.selectlimit.html
which tells me that this only works with adodb (but you probably use this since it's an access db)

You can try this instead which should be the same "SELECT * FROM TABLE LIMIT 3 OFFSET 2"
/Dan

{cell 260}
-{ a vibration is a movement that doesn't know which way to go }-

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 12-01-2003 10:59

Yeh i tried that as well, it did the same thing =/

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 12-01-2003 14:05

Have you tried something like
"SELECT * FROM TABLE LIMIT 3, 2"

That's generally how I do it, and it works well.

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 12-01-2003 17:34

Yep ^

I don't know anything about Access, but with most databses that should be the better way to do it.

I generally prefer to let the DB do the work first, then pass to PHP only what the DB can't do.

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 12-02-2003 00:08

Yeh i couldnt get any of those to work, bloody annoying. Im sure the access database should use that .. I ended up just doing a hack way around it, a bit gay as it will take more time even if it is minimal. When the database gets bigger it would probably becomea problem

« BackwardsOnwards »

Show Forum Drop Down Menu