Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
0 users currently in Programming. |
User | Post |
blackhole89 Posts: 353/427 |
Originally posted by AliceOriginally posted by blackhole89 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 AliceOriginally posted by blackhole89 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 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: <'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. |