[code=php]<?php
session_start();
require_once(‘mysql_connect.php’);
if (isset($_SESSION[‘username’])){
$user = $_SESSION[‘username’];
//////// Select user information from database
$userquery = “SELECT * FROM `users` WHERE `username` = ‘$user'”;
$userresult = mysql_query($userquery);
while ($userrow = mysql_fetch_array($userresult)){
$username = $userrow[‘username’];
$userid = $userrow[‘id’];
$character1 = $userrow[‘character1’];
$character2 = $userrow[‘character2’];
$character3 = $userrow[‘character3’];
//////// Select characters from database
$charquery = “SELECT * FROM `characters` WHERE `id` = ‘$character1’ OR `id` = ‘$character2’ OR `id` = ‘$character3′”;
$charresult = mysql_query($charquery);
while ($charrow = mysql_fetch_array($charresult)) {
$race = $charrow[‘race’];
$gender = $charrow[‘gender’];
//////// Select inventory from database
$invquery = “SELECT * FROM `inventory` WHERE `userid` = ‘$userid'”;
$invresult = mysql_query($invquery);
while ($invrow = mysql_fetch_array($invresult)) {
$itemid = $invrow[‘itemid’];
$charid = $invrow[‘charid’];
$quantity = $invrow[‘quantity’];
//////// Select items from database
$itemquery = “SELECT FROM `items` WHERE `id` = ‘$itemid'”;
$itemresult = mysql_query($itemquery);
while ($itemrow = mysql_fetch_array($itemresult)){
$etype = $itemrow[‘etype’];
$iattack = $itemrow[‘iattack’];
$idefense = $itemrow[‘idefense’];
$imind = $itemrow[‘imind’];
$iaccuracy = $itemrow[‘iaccuracy’];
$ispeed = $itemrow[‘ispeed’];
do {
echo “Charid is set for”. $itemid;
}while (isset($charid));
}
}
}
}
}else{
echo “log in”;
}
?>
This code keeps on returning this error for me
[QUOTE]
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /websites/LinuxPackage04/ch/ao/sj/chaosjump.com/public_html/charconfig.php on line 31
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /websites/LinuxPackage04/ch/ao/sj/chaosjump.com/public_html/charconfig.php on line 31
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /websites/LinuxPackage04/ch/ao/sj/chaosjump.com/public_html/charconfig.php on line 31
But I can’t see what it is I did wrong. The line in question is this.
[code=php] while ($itemrow = mysql_fetch_array($itemresult)){
And then finally, the do while is supposed to echo the values of the items that have a charid value assigned to them, if that makes sense. Would this work in theory since I’ve assigned the the mysql arrays to variables? If that doesn’t make much sense just let me know, I’ll try to explain it in more detail.