(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-17-24 11:47 PM
0 users currently in Programming.
Acmlm's Board - I3 Archive - Programming - hm, can somebody explain me how to make a page system?
  
User name:
Password:
Reply:
 
Options: - -
Quik-Attach:
Preview for more options

Max size 1.00 MB, types: png, gif, jpg, txt, zip, rar, tar, gz, 7z, ace, mp3, ogg, mid, ips, bz2, lzh, psd

UserPost
blackhole89
Posts: 353/427
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.
D 2007
Posts: 346/497
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.
darkwitch
Posts: 156/214
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.
HyperHacker
Posts: 4453/5072
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
Posts: 155/214
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.
blackhole89
Posts: 352/427
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
D 2007
Posts: 345/497
You should really reconsider what you're doing if you can't figure out how to do pages.

darkwitch
Posts: 154/214
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.
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.003 seconds; used 351.45 kB (max 401.38 kB)