(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
05-03-24 08:17 AM
0 users currently in Programming.
Acmlm's Board - I3 Archive - Programming - hm, can somebody explain me how to make a page system? New poll | |
Add to favorites | Next newer thread | Next older thread
User Post
darkwitch

Red Cheep-cheep


 





Since: 10-16-06
From: Puerto Rico

Last post: 6283 days
Last view: 6283 days
Posted on 12-16-06 06:10 PM Link | Quote
First of all this is PHP.

Well, I'm working on a battle arena for acmlmboard, but, I need to know how to make the "Pages: 1-2-3-4-etc...". Because I made a monster encyclopedia which lists all monsters and I want to limit it to 30 monsters per page, but reading existing acmlm board files ain't helping _¬ .

I have searched in php.net but no help either, anyone care to explain me how to do it? Is the only thing the arena needs.
D 2007
D


 





Since: 02-19-06

Last post: 6330 days
Last view: 6330 days
Posted on 12-16-06 06:14 PM Link | Quote
You should really reconsider what you're doing if you can't figure out how to do pages.

blackhole89
Moronic Thread Bodycount: 17
(since 2006-08-21 09:50 EST)
F5 F5 F5 F5 F5


 





Since: 12-31-69
From: Dresden/SN/DE

Last post: 6285 days
Last view: 6283 days
Skype
Posted on 12-16-06 06:44 PM Link | Quote
Xkeeper has a point right there.

To be of some actual help, though, try the following... assuming your "monster encyclopedia" uses a MySQL based backend
- add $start=$_GET['page']*30; somewhere at the beginning of the script
- append "LIMIT $start, 30" to your query
- calculate $npages:
-- $res=mysql_query("SELECT count(*) FROM whateveryourmonstertableis"); $d=mysql_fetch_array($res); $npages=ceil($d[0]/30.0);
- for($i=0;$i<$npages;++$i) echo "<a href=thispagesname.php?page=$i>$i</a> ";

edit1: hit submit too early
edit2: &lt;'d the <s in HTML quoted


(edited by blackhole89 on 12-16-06 05:48 PM)
darkwitch

Red Cheep-cheep


 





Since: 10-16-06
From: Puerto Rico

Last post: 6283 days
Last view: 6283 days
Posted on 12-16-06 06:59 PM Link | Quote
Well, is far to late to reconsider as I already finished it, and it has all functions working perfectly, all I needed to know was that. The arena is a 35kb file as I stuffed everything there..... It comes with an Itemshop (items can be used in battles), Monster encyclopedia, add monster, add arena, new battle, stats and a help area.

What I am not sure is releasing it to public or not...


edit: thanks a lot blackhole89.


(edited by darkwitch on 12-16-06 06:00 PM)
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6284 days
Last view: 6284 days
Posted on 12-17-06 12:48 AM Link | Quote
Originally posted by blackhole89
add $start=$_GET['page']*30; somewhere at the beginning of the script

I'm not sure what happens if you multiply a non-number in PHP, but you might want to use $start = intval($_GET['page']) * 30 just to be safe.
darkwitch

Red Cheep-cheep


 





Since: 10-16-06
From: Puerto Rico

Last post: 6283 days
Last view: 6283 days
Posted on 12-17-06 01:24 PM Link | Quote
Ok, now I will have to look in php.net what exactly does intval as a friend of mine also told me to use it somewhere on the file.

Thanks HH.
D 2007
D


 





Since: 02-19-06

Last post: 6330 days
Last view: 6330 days
Posted on 12-17-06 01:25 PM Link | Quote
Originally posted by Alice
Originally posted by blackhole89
add $start=$_GET['page']*30; somewhere at the beginning of the script

I'm not sure what happens if you multiply a non-number in PHP, but you might want to use $start = intval($_GET['page']) * 30 just to be safe.

You get zero.
blackhole89
Moronic Thread Bodycount: 17
(since 2006-08-21 09:50 EST)
F5 F5 F5 F5 F5


 





Since: 12-31-69
From: Dresden/SN/DE

Last post: 6285 days
Last view: 6283 days
Skype
Posted on 12-17-06 01:27 PM Link | Quote
Originally posted by Alice
Originally posted by blackhole89
add $start=$_GET['page']*30; somewhere at the beginning of the script

I'm not sure what happens if you multiply a non-number in PHP, but you might want to use $start = intval($_GET['page']) * 30 just to be safe.

A string used in a numerical context gets parsed like it would be with sscanf(string,"%d",&num). "dfshsdfh"*2 gives 0, "1234dsdfg"*2 gives 2468.
Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - Programming - hm, can somebody explain me how to make a page system? |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.014 seconds; used 381.95 kB (max 473.91 kB)