The online racing simulator
CreateButton along with page split
(3 posts, started )
CreateButton along with page split
I have no idea how to split results to pages.. Could anyone help out a bit? Smile

Example:


CreateButton:

<?php 
//BG
$this->createButton($ucid'KEY_NAME_1''GROUP_NAME'''505010079016);

//Title
$this->createButton($ucid'KEY_NAME_2''GROUP_NAME''^7Players Database'5152988032);

//Player ID
$this->createButton($ucid'KEY_NAME_3''GROUP_NAME''^7Player ID'5162155032);
$this->createButton($ucid'KEY_NAME_7''GROUP_NAME''^71'5169155032);
$this->createButton($ucid'KEY_NAME_11''GROUP_NAME''^72'5174155032);
$this->createButton($ucid'KEY_NAME_12''GROUP_NAME''^73'5179155032);
$this->createButton($ucid'KEY_NAME_13''GROUP_NAME''^74'5184155032);
$this->createButton($ucid'KEY_NAME_14''GROUP_NAME''^75'5189155032);
$this->createButton($ucid'KEY_NAME_15''GROUP_NAME''^76'5194155032);
$this->createButton($ucid'KEY_NAME_16''GROUP_NAME''^77'5199155032);
$this->createButton($ucid'KEY_NAME_17''GROUP_NAME''^78'51104155032);
$this->createButton($ucid'KEY_NAME_18''GROUP_NAME''^79'51109155032);
$this->createButton($ucid'KEY_NAME_19''GROUP_NAME''^710'51114155032);

//Player Name
$this->createButton($ucid'KEY_NAME_4''GROUP_NAME''^7Player Name'6662255032);
$this->createButton($ucid'KEY_NAME_8''GROUP_NAME''Player1'6669255032);
$this->createButton($ucid'KEY_NAME_28''GROUP_NAME''Player2'6674255032);
$this->createButton($ucid'KEY_NAME_29''GROUP_NAME''Player3'6679255032);
$this->createButton($ucid'KEY_NAME_30''GROUP_NAME''Player4'6684255032);
$this->createButton($ucid'KEY_NAME_31''GROUP_NAME''Player5'6689255032);
$this->createButton($ucid'KEY_NAME_32''GROUP_NAME''Player6'6694255032);
$this->createButton($ucid'KEY_NAME_33''GROUP_NAME''Player7'6699255032);
$this->createButton($ucid'KEY_NAME_34''GROUP_NAME''Player8'66104255032);
$this->createButton($ucid'KEY_NAME_35''GROUP_NAME''Player9'66109255032);
$this->createButton($ucid'KEY_NAME_36''GROUP_NAME''Player10'66114255032);

//S2 Licence
$this->createButton($ucid'KEY_NAME_5''GROUP_NAME''^7S2 Licence'9162255032);
$this->createButton($ucid'KEY_NAME_9''GROUP_NAME''Player1'9169255032);
$this->createButton($ucid'KEY_NAME_37''GROUP_NAME''Player2'9174255032);
$this->createButton($ucid'KEY_NAME_38''GROUP_NAME''Player3'9179255032);
$this->createButton($ucid'KEY_NAME_39''GROUP_NAME''Player4'9184255032);
$this->createButton($ucid'KEY_NAME_40''GROUP_NAME''Player5'9189255032);
$this->createButton($ucid'KEY_NAME_41''GROUP_NAME''Player6'9194255032);
$this->createButton($ucid'KEY_NAME_42''GROUP_NAME''Player7'9199255032);
$this->createButton($ucid'KEY_NAME_43''GROUP_NAME''Player8'91104255032);
$this->createButton($ucid'KEY_NAME_44''GROUP_NAME''Player9'91109255032);
$this->createButton($ucid'KEY_NAME_45''GROUP_NAME''Player10'91114255032);

//Last Login
$this->createButton($ucid'KEY_NAME_6''GROUP_NAME''^7Last Login'11662335032);
$this->createButton($ucid'KEY_NAME_10''GROUP_NAME''-'11669335032);
$this->createButton($ucid'KEY_NAME_46''GROUP_NAME''-'11674335032);
$this->createButton($ucid'KEY_NAME_47''GROUP_NAME''-'11679335032);
$this->createButton($ucid'KEY_NAME_48''GROUP_NAME''-'11684335032);
$this->createButton($ucid'KEY_NAME_49''GROUP_NAME''-'11689335032);
$this->createButton($ucid'KEY_NAME_50''GROUP_NAME''-'11694335032);
$this->createButton($ucid'KEY_NAME_51''GROUP_NAME''-'11699335032);
$this->createButton($ucid'KEY_NAME_52''GROUP_NAME''-'116104335032);
$this->createButton($ucid'KEY_NAME_53''GROUP_NAME''-'116109335032);
$this->createButton($ucid'KEY_NAME_54''GROUP_NAME''-'116114335032);

//Pages
$this->createButton($ucid'KEY_NAME_55''GROUP_NAME''^7Previous Page'64121175048);
$this->createButton($ucid'KEY_NAME_20''GROUP_NAME''^71'8212155032);
$this->createButton($ucid'KEY_NAME_21''GROUP_NAME''^22'8712155032);
$this->createButton($ucid'KEY_NAME_22''GROUP_NAME''^73'9212155032);
$this->createButton($ucid'KEY_NAME_23''GROUP_NAME''^74'9712155032);
$this->createButton($ucid'KEY_NAME_24''GROUP_NAME''^75'10212155032);
$this->createButton($ucid'KEY_NAME_25''GROUP_NAME''^7...'10712155032);
$this->createButton($ucid'KEY_NAME_26''GROUP_NAME''^7325'11212155032);
$this->createButton($ucid'KEY_NAME_27''GROUP_NAME''^7Next Page'118121175048);

?>

Sql:

<?php 
SELECT player_id
,player_name,s2_licence,last_login FROM `playersORDER BY `user_idASC
?>


SELECT player_id,player_name,s2_licence,last_login FROM `players` ORDER BY `user_id` ASC LIMIT 0, 9;

You'll have to store state somewhere if they click on Page 1 vs 2, 3, 4, ect.

If they are on Page 1, it's just the numbers like above. But if it's page two then you'll want to `LIMIT 10, 19`; Page 2 `LIMIT 20, 29`, ect.
Quote from Dygear :
SELECT player_id,player_name,s2_licence,last_login FROM `players` ORDER BY `user_id` ASC LIMIT 0, 9;

You'll have to store state somewhere if they click on Page 1 vs 2, 3, 4, ect.

If they are on Page 1, it's just the numbers like above. But if it's page two then you'll want to `LIMIT 10, 19`; Page 2 `LIMIT 20, 29`, ect.

Thank you!
Well, i got something like this:


<?php 
case "db":
{
$C->db_start 0;
$C->db_end 10;
$C->db_page 1;

$this->createButton($C->UCID'KEY_NAME_1''GROUP_NAME'''505010079016);
$this->createButton($C->UCID'KEY_NAME_2''GROUP_NAME''^7Players Database'5152988032);
$this->createButton($C->UCID'DB_USER_ID''GROUP_NAME''^7Player ID'5162155032);
$this->createButton($C->UCID'DB_PLAYER_NAME''GROUP_NAME''^7Player Name'6662255032);
$this->createButton($C->UCID'DB_S2_LICENCE''GROUP_NAME''^7S2 Licence'9162255032);
$this->createButton($C->UCID'DB_LASTLOGIN''GROUP_NAME''^7Last Login'11662335032);

$haha $this->db->select("SELECT user_id,player_name,s2_username,user_lastlogin FROM `users` ORDER BY `user_id` ASC LIMIT ".$C->db_start.",".$C->db_end."");
$haha_total $this->db->selectOne("SELECT COUNT(*)  as total_players FROM users");
$C->db_totalpages round($haha_total['total_players'] / 10);

$top 69;
for (
$i 0$i 10$i++)
{
$this->createButton($C->UCID'DB_USER_ID_'.$i'GROUP_NAME''^7'.$haha[$i]["user_id"], 51$top155032);
$this->createButton($C->UCID'DB_PLAYER_NAME_'.$i'GROUP_NAME''^8'.$haha[$i]["player_name"], 66$top255032);
$this->createButton($C->UCID'DB_S2_LICENCE_'.$i'GROUP_NAME''^8'.$haha[$i]["s2_username"], 91$top255032);
$this->createButton($C->UCID'DB_LASTLOGIN_'.$i'GROUP_NAME''^8'.date("Y-m-d H:i:s",$haha[$i]["user_lastlogin"]), 116$top335032);
$top += 5;
}

$this->createButtonClick($C->UCID'DB_PREVIOUSPAGE''GROUP_NAME''^2<'8312255032"PLAYER_DB_PREVIOUS");
$this->createButton($C->UCID'DB_CURRENT_PAGE''GROUP_NAME''^7Page: ^2'.$C->db_page.'^7/^2'.$C->db_totalpages88122245032);
$this->createButtonClick($C->UCID'DB_NEXTPAGE''GROUP_NAME''^2>'11212255032"PLAYER_DB_NEXT");

$this->createButton($C->UCID'DB_TOTAL_PLAYERS''GROUP_NAME''^7Total Players: ^2'.$haha_total['total_players'], 119122305032);
}
break;
?>


<?php 
public function PLAYER_DB_NEXT(IS_BTC $BTC)
{
$C $this->getClientByUCID($BTC->UCID);

if(
$C->db_page $C->db_totalpages)
{
$C->db_start+=10;
$C->db_end+=10;
$C->db_page += 1;

$haha $this->db->select("SELECT user_id,player_name,s2_username,user_lastlogin FROM `users` ORDER BY `user_id` ASC LIMIT ".$C->db_start.",".$C->db_end."");


$top 69;
for (
$i 0$i 10$i++)
{
$this->createButton($C->UCID'DB_USER_ID_'.$i'GROUP_NAME''^7'.$haha[$i]["user_id"], 51$top155032);
$this->createButton($C->UCID'DB_PLAYER_NAME_'.$i'GROUP_NAME''^8'.$haha[$i]["player_name"], 66$top255032);
$this->createButton($C->UCID'DB_S2_LICENCE_'.$i'GROUP_NAME''^8'.$haha[$i]["s2_username"], 91$top255032);
$this->createButton($C->UCID'DB_LASTLOGIN_'.$i'GROUP_NAME''^8'.date("Y-m-d H:i:s",$haha[$i]["user_lastlogin"]), 116$top335032);
$top += 5;
}
$this->createButton($C->UCID'DB_CURRENT_PAGE''GROUP_NAME''^7Page: ^2'.$C->db_page.'^7/^2'.$C->db_totalpages88122245032);
}
}

public function 
PLAYER_DB_PREVIOUS(IS_BTC $BTC)
{
$C $this->getClientByUCID($BTC->UCID);

if(
$C->db_start 0)
{
$C->db_start-=10;
$C->db_end-=10;
$C->db_page -= 1;
$haha $this->db->select("SELECT user_id,player_name,s2_username,user_lastlogin FROM `users` ORDER BY `user_id` ASC LIMIT ".$C->db_start.",".$C->db_end."");

$top 69;
for (
$i 0$i 10$i++)
{
$this->createButton($C->UCID'DB_USER_ID_'.$i'GROUP_NAME''^7'.$haha[$i]["user_id"], 51$top155032);
$this->createButton($C->UCID'DB_PLAYER_NAME_'.$i'GROUP_NAME''^8'.$haha[$i]["player_name"], 66$top255032);
$this->createButton($C->UCID'DB_S2_LICENCE_'.$i'GROUP_NAME''^8'.$haha[$i]["s2_username"], 91$top255032);
$this->createButton($C->UCID'DB_LASTLOGIN_'.$i'GROUP_NAME''^8'.date("Y-m-d H:i:s",$haha[$i]["user_lastlogin"]), 116$top335032);
$top += 5;
}
$this->createButton($C->UCID'DB_CURRENT_PAGE''GROUP_NAME''^7Page: ^2'.$C->db_page.'^7/^2'.$C->db_totalpages88122245032);
}
}
?>

Next Page problem:
Error: Undefined offset error on last page

CreateButton along with page split
(3 posts, started )
FGED GREDG RDFGDR GSFDG