PDA

View Full Version : beta item php script



runiker
19-08-08, 03:23 AM
here is what it should do
when the player types in the name of the item it should
bring up the item cost and id. At this point if anyone is
willing to try it out and tell me if it works that would help.
If it works i will expand on this script if not i might just
ditch it untill i learn mroe php.



<?php
echo "<link href='style2.css' type='text/css' rel='stylesheet'>";
if(isset($_POST['submit']))
{
$itemnumber = $_POST['account'];
include_once "./config/configc.php";
$con = mysql_connect($aHost.":".$aPort, $aUsername, $aPass) or die(mysql_error());
mysql_select_db($aDatabase) or die(mysql_error());

$itemname = mysql_real_escape_string($itemname);

$query = "SELECT name1 FROM items WHERE name1 = '".$itemname."'";

$result = mysql_query($query) or die(mysql_error());
$numrows = mysql_num_rows($result);

echo "<tr><td align=center>";

//if no rows exist, the character does not exist
if($numrows == 0)
{
die("Bad name please try again!");
}
$result = mysql_query($query) or die(mysql_error());

$itemnumber= mysql_query("SELECT id FROM items where name1 = '".$itemname."'");
$itemcost= mysql_query("SELECT buyprice FROM items where name1 = '".$itemname."'");

$name1 = mysql_result($top10names,0);

echo "The item Number is '".$itemnumber."' Keep this for guide/'s!";
echo "The item cost is '".$itemcost."' copper!";
echo "The item Name is '".$itemname."' !";

echo "</td></tr>";

//close mysql connection
mysql_close();
}
//this controls the viewing of the page
else
{
echo "<form name=myform method=post action='./passchanger.php'>";

echo "<tr><td colspan=2><hr></td></tr>";
echo "<tr><td colspan=2><hr></td></tr>";

echo "<center>";
echo "<tr><td width=125>Item Name: </td><td><input type=text name=itemname value=''></td></tr>";
echo "</br>";

echo "<tr><td colspan=2 align=center><br><input type=submit name=submit value=Submit></td></tr>";
echo "</form>";
echo "</center>";
}
echo "<center>";
echo "</table>";
echo "<br />";
echo "Script made by Runiker.";
echo "<br />";
?>