for a while ive been playing with an sql database and so far ive been able to create a database, setup a script for adding data to the database, and a simple page to display the information in the database... but this is where i am stuck..
i would like to do two things,
1) change the script so that it will list the items based on particular things, the database primarilly is about a mmorpg, its a database holding the information on various "monsters", each monster has various values and drops various items, so i have setup the database in order to set these specifics to each monster name.
my problem is i would like to be able to set things like "Race - insect", to display all the monsters with that specific race, or "Drops - gold", to display monsters that drop gold etc.
2) and second i would like a simple seach script that searches the values of the entire database, and returns only the "monsters" with matching values..
and since i havent been using php with mysql that long.. this is why i am now seeking assistance..
So, any help?
starts reading various php e-books while he waits for reply
Below is the current script im using to display the info
<?
mysql_connect("localhost", "dbusername", "dbpassword");
$query = "SELECT * FROM monsters ORDER BY name";
$result = mysql_db_query("dbname", $query);
if ($result) {
while ($r = mysql_fetch_array($result)) {
$name = $r["name"];
$hp = $r["hp"];
$jexp = $r["jexp"];
$bexp = $r["bexp"];
$drops = $r["drops"];
$agg = $r["agg"];
$loot = $r["loot"];
$poison = $r["poison"];
$holy = $r["holy"];
$shadow = $r["shadow"];
$ghost = $r["ghost"];
$undead = $r["undead"];
$water = $r["water"];
$fire = $r["fire"];
$wind = $r["wind"];
$earth = $r["earth"];
$eleclass = $r["eleclass"];
$monsize = $r["monsize"];
$monmap = $r["monmap"];
$monimg = $r["monimg"];
$monskill = $r["monskill"];
$monlvl = $r["monlvl"];
$monrate = $r["monrate"];
$monatk = $r["monatk"];
$mondef = $r["mondef"];
$monmdef = $r["monmdef"];
$monrace = $r["monrace"];
$monhit = $r["monhit"];
$monflee = $r["monflee"];
echo'
//
HTML WHICH CONTANTS THE ABOVE VALUES GOES HERE (removed because it's huge)
//
';
}
echo "</ul>";
} else {
echo "No data.";
}
mysql_free_result($result);
?>
so to recap, i would like to be able to specify $name in the url, eg monsters.php?name=alarm
example of the above script being used; http://www.lostnovice.com/monsters.php