I want to select the 'ctype' column in the inventory table.
The Inventory table is like a list of items,with fields :
id,description,rarity,name and 'ctype'.
The 'ctype' is for getting what item can create a custom(its a virtual sim game, so its like custom pets).
I also have the 'owned_items' table that stores the owned items, it contains the
id(just an auto-increment thing), itemid(the id of the item in the inventory table), owner and the amount.
I am trying to get the items the users have, that's 'ctype' isnt 0. I am guessing this will make it an array and I'll have to use foreach or the for loop..yet I am unsure exactly what I must do.
Anyways, this is what I have so far.
Thank you for you time
The Inventory table is like a list of items,with fields :
id,description,rarity,name and 'ctype'.
The 'ctype' is for getting what item can create a custom(its a virtual sim game, so its like custom pets).
I also have the 'owned_items' table that stores the owned items, it contains the
id(just an auto-increment thing), itemid(the id of the item in the inventory table), owner and the amount.
I am trying to get the items the users have, that's 'ctype' isnt 0. I am guessing this will make it an array and I'll have to use foreach or the for loop..yet I am unsure exactly what I must do.
Anyways, this is what I have so far.
PHP Code:
<?php
$itemcu = mysql_query("SELECT * FROM `inventory` WHERE `ctype`!='0'");
$cit = mysql_fetch_array($itemcu);
$fi = "SELECT * FROM `owned_items` WHERE `owner` = '" . $_SESSION['id'] . "' AND `itemid` = '{$cit['id']}'";
$findi = mysql_query($fi);
$result26 = mysql_fetch_assoc($findi);
//Check if they dont have any custom type item
if ($result26['amount'] == '0' or $result26['amount'] == '') {
die("You dont have this item.");
}
//It's not blank so continue
if ($result26['id'] != '') {
//Tokens, upload image and pick ID of pet the image will replace..
echo '
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="ck" value="' . $_SESSION['token'] . '"><br>
Pet ID: <BR><input type="text" name="pid">
<input type="hidden" name="from" value=' . $user . '>
<BR>';
$co = $result26['itemid'];
$i = 0;
while ($i < $co) {
$formdrop = $formdrop . "<option value='" . $i . "'>" . $co . "</option>";
$i++;
}
echo '<select style="width:150px" name="type">
' . $formdrop . '
</select>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<tr>
<td>Upload custom image of pet
<input name="ufile" type="file" id="ufile" size="50" /></td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value="Upload" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
';
} else {
//They have no items to create the custom pet
echo 'Sorry You need certain items to be able to apply for a custom pet';
}
?>
