• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

I need a script (php+sql)

Kavvson

Gdy boli cie glowa wez
Joined
Jun 25, 2008
Messages
1,177
Reaction score
72
Location
Poland
I search for a stand alone script that will give me the ability to check a characters details form a database.

I need just like a easy example no layout needed.

1. Index page you write a players name -> the content will load or switch in a other page ( ?editcharacter=name)
2. There will be displayed like nick,lvl all form database


Regards. I really need it :))
 
PHP:
	$id = $player->getCustomField("id");
			 $top = $SQL->query('SELECT * FROM player_items WHERE player_id = '.$id.' AND pid = '.$list[$pid].';')->fetch();


I think the query needs a better modification.

PHP:
 $top = $mysqli->query( 'SELECT `i`.* FROM `player_items` AS `i` LEFT JOIN `players` AS `p` ON `p`.`id` = `i`.`player_id` WHERE `p`.`name` = \''.$mysqli->real_escape_string( $_GET['editcharacter'] ).'\';' )->fetch_assoc( );

Uhm doesn't work properly. It displays in all fields the same item id(image) :(
 
SQL:
SELECT `i`.* FROM `player_items` AS `i` LEFT JOIN `players` AS `p` ON `p`.`id` = `i`.`player_id` WHERE `p`.`name` = ' . $mysqli->real_escape_string($_GET['editcharacter']) . ';
try this
 
Same :/

Could someone write the script based on the query

PHP:
 $top = $mysqli->query( 'SELECT `i`.* FROM `player_items` AS `i` LEFT JOIN `players` AS `p` ON `p`.`id` = `i`.`player_id` WHERE `p`.`name` = \''.$mysqli->real_escape_string( $_GET['editcharacter'] ).'\';' )->fetch_assoc( );
 
Last edited by a moderator:
Try this.
PHP:
$items = 0;
$list = array( 2, 1, 3, 6, 4, 5, 9, 7, 10, 8 );
foreach( $list as $pid => $name )
{
    $items++;
    $equipment = $mysqli->query( 'SELECT `i`.* FROM `player_items` AS `i` LEFT JOIN `players` AS `p` ON `p`.`id` = `i`.`player_id` WHERE `p`.`name` = \''.$mysqli->real_escape_string( $_GET['editcharacter'] ).'\' AND `i`.`pid` = '.$mysqli->real_escape_string( $list[$pid] ).';' )->fetch_assoc( );
    
    echo '<img src="images/'.$equipment['itemtype'].'.gif" alt="" />';
    if ( $items % 3 === false )
    {
        echo '<br />';
    }
}
 
Uhm FireBug shows me (hidden)

HTML:
<img src="http://otland.net/images/items/.gif" alt=""><img src="http://otland.net/images/items/.gif" alt=""><img src="http://otland.net/images/items/.gif" alt=""><img src="http://otland.net/images/items/.gif" alt=""><img src="http://otland.net/images/items/.gif" alt=""><img src="http://otland.net/images/items/.gif" alt=""><img src="http://otland.net/images/items/.gif" alt=""><img src="http://otland.net/images/items/.gif" alt=""><img src="http://otland.net/images/items/.gif" alt=""><img src="http://otland.net/images/items/.gif" alt="">

no otland ( they made a script i guess that adds it :D )
 
PHP:
list( $list, $items ) = array( array( 2, 1, 3, 6, 4, 5, 9, 7, 10, 8 ), 0 );
foreach( $list as $pid )
{
    $items++;
    $equipment = $mysqli->query( 'SELECT * FROM `player_items` AS `i` LEFT JOIN `players` AS `p` ON `p`.`id` = `i`.`player_id` WHERE `p`.`name` = \''.$mysqli->real_escape_string( $_GET['editcharacter'] ).'\' AND `i`.`pid` = '.$pid.';' )->fetch_assoc( );
    
    switch( $equipment['itemtype'] )
    {
        case false:
            echo 'No equipment at spot #'.$pid.'<br />';
            break;
            
        default:
            echo '<img src="images/items/'.$equipment['itemtype'].'.gif" alt="" />';
            break;
    }
    if ( $items % 3 === false )
    {
        echo '<br />';
    }
}
 
Code:
No equipment at spot #2
No equipment at spot #1
No equipment at spot #3
No equipment at spot #6
No equipment at spot #4
No equipment at spot #5
No equipment at spot #9
No equipment at spot #7
No equipment at spot #10
No equipment at spot #8


DataBase

player_id pid sid itemtype count attributes
1 101 1 2457 1 [BLOB - 0bajtów]
1 102 3 1988 1 [BLOB - 0bajtów]
1 103 4 2463 1 [BLOB - 0bajtów]
1 112 102 2554 1 [BLOB - 0bajtów]
 
Kavvson, troja's warning was legit. You should not bump your thread unless 24 hours have passed since the last post on it (considering that one of your posts was actually a bump). Also you should use the "Edit" button instead of posting multiple times in a row. Heed this warning or I will have to proceed to stricter actions in case you don't comply with these rules.
 
Back
Top