Thank you for being so patient with me...
Here is the function that I wrote to print all the items in a...hmm. I just thought of something. Well I'll work on that, but I'll also show you what I have at the moment.
function Print_Items ($category) {
$host="localhost";
$user="***";
$password="***";
$db_name="***";
$table_name="armoury";
$link=mysql_connect($host,$user,$password);
$cat_count=count($category);
for ($n=0; $n<$cat_count; $n++) {
$item_type=$category[$n];
print("item_type is $item_type<br>\n");
$query="SELECT*from $table_name where type='$item_type' ";
$result = mysql_db_query($db_name,$query,$link);
print("<h4>$item_type</h4>\n");
print("<table><tr align=center valign=top>\n");
print("<td align=center valign=top>Item</td>\n");
print("<td align=center valign=top>Stats</td>\n");
print("<td align=center valign=top>Price</td>\n");
print("<td align=center valign=top>Character</td>\n");
print("<td align=center valign=top>Best Time to Catch Seller</td>\n");
print("</tr>\n");
//fetch results
while ($row=mysql_fetch_array($result)) {
print("<tr align=center valign=top>\n");
print("<td align=center valign=top>$row[item_name]</td>\n");
print("<td align=center valign=top>$row[stats]</td>\n");
print("<td align=center valign=top>$row[price]</td>\n");
print("<td align=center valign=top>$row[char_name]</td>\n");
print("<td align=center valign=top>$row[best_time]</td>\n");
print("</tr>\n");
}
mysql_close($link);
print("</table>\n");
print("<a href=\"#top\">[Return to Top]</a><br><br>\n");}
} //end of function
Here's where I call the function:
<hr>
<?php
$armor=array("Head","Neck","Face","Chest","Shoulders","Arms","Wrist","Hands","Back","Legs","Feet","Waist");
$weapons=array("1 hand slash","2 hand slash","1 hand blunt","2 hand blunt","Piercing","Hand to Hand","Range");
$containers=array("Containers");
$jewelry=array("Fingers","Wrist","Ear","Neck");
$misc=array("Miscellaneous");
print("<h3>Armor</h3>\n");
Print_Items($armor);
print("<hr>\n");
?>
I have a thought where I should just call the function with each item type rather than trying to pass an array. I think that I could then do what you suggested earlier. I'll try that, but please take a look at this and tell me how ugly it is.
Here are the errors that I get:
Warning: mysql_db_query(): 1 is not a valid MySQL-Link resource in /home/mensch/www/anachron_test/armoury-test.php on line 17
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mensch/www/anachron_test/armoury-test.php on line 30
Warning: mysql_close(): 1 is not a valid MySQL-Link resource in /home/mensch/www/anachron_test/armoury-test.php on line 40
These repeat over and over.