• 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!

[Request] PHP+ sql script

Kavvson

Gdy boli cie glowa wez
Joined
Jun 25, 2008
Messages
1,177
Reaction score
72
Location
Poland
Im searching for a code for :

Standalone - Foreach news displayer (gesior)
Standalone - Show equipment as (foreach + input type=text value="item numbers")


I would be really thankful
 
Code:
<?PHP
	mysql_connect("localhost", "root", "");
	mysql_select_db("otserv");

	$data = mysql_query("SELECT * FROM `news`;");
	while($news = mysql_fetch_array($data))
		var_dump($news);

	unset($data);
	mysql_close();
?>
 
Showed the first value only
PHP:
	while($news = mysql_fetch_array($data))

		ECHO 'Text : '.$news['text'].' <br>';
		ECHO $news['topic'];
	    ECHO $news['date']; 
		ECHO $news['author'];
		ECHO $news['author_id'];
		ECHO $news['image_id'];
		ECHO $news['topic'];
 
Umm, maybe something like this:
Code:
<?PHP
	if(!$_GET['name'])
		die("Correct usage: ?name=Nickname+of+player");

	$slots = array(
		1 => "Head (1)",
		2 => "Necklace (Amulet) (2)",
		3 => "Backpack (3)",
		4 => "Armor (4)",
		5 => "Right Hand (5)",
		6 => "Left Hand (6)",
		7 => "Legs (7)",
		8 => "Feet (8)",
		9 => "Ring (9)",
		10 => "Ammo (10)"
	);
	mysql_connect("localhost", "root", "");
	mysql_select_db("otserv");

	$data = mysql_query("SELECT `itemtype`, `sid`, `count` FROM `player_items` WHERE `player_id` IN (SELECT `id` FROM `players` WHERE `name` = '".addslashes($_GET['name'])."');");
	while($item = mysql_fetch_array($data))
		echo "Slot: ".$slots[($item['sid'] - 100)]." | ItemID: <input type=\"text\" name=\"itemtype\" value=\"".$item['itemtype']."\" /> | Count: <input type=\"text\" name=\"count\" value=\"".$item['count']."\" />";

	unset($data);
	mysql_close();
?>


Showed the first value only
PHP:
	while($news = mysql_fetch_array($data))

		ECHO 'Text : '.$news['text'].' <br>';
		ECHO $news['topic'];
	    ECHO $news['date']; 
		ECHO $news['author'];
		ECHO $news['author_id'];
		ECHO $news['image_id'];
		ECHO $news['topic'];

Should be:
Code:
while($news = mysql_fetch_array($data))
{
	echo 'Text : '.$news['text'].' <br>';
	echo $news['topic'];
	echo $news['date']; 
	echo $news['author'];
	echo $news['author_id'];
	echo $news['image_id'];
	echo $news['topic'];
}

{ } :p!
 
Last edited:
W0w you are really amazing :))! Pro Mf.!

But it also shows fields:

Code:
player_id 	pid 	sid 	itemtype 	count 	attributes
2 	103 	111 	2674 	1  	[BLOB - 2bajtów]
2 	110 	112 	2432 	1 	[BLOB - 0bajtów]
2 	110 	113 	5480 	1 	[BLOB - 0bajtów]
2 	110 	114 	6500 	1 	[BLOB - 2bajtów]
 
I guess this should display Slots 1-10


r2j61l.jpg
 
Back
Top