I am thinking if doing the following
1 table for users: ID username password....
1 table for items ID item desc image....
1 table for userItems ID itemID userID
To retrieve info i can use this method:
$query = "SELECT * FROM userItems WHERE ID = '$userID' " ;
$results = mysql_query($query);
echo "xml=<?xml version=\"1.0\"?>";
echo "<items>";
while($line = mysql_fetch_assoc($results)){
echo "<val>". $line["itemID"] . "</val>";
}
echo "</items >";
Now i want to retrieve items info from the table items
I send item ID to a php file and do the following code
$query = "SELECT * FROM userItems WHERE ID = '$userID' " ;
$results = mysql_query($query);
echo "xml=<?xml version=\"1.0\"?>";
echo "<items>";
while($line = mysql_fetch_assoc($results)){
echo "<val>". $line["ID"] . "</val>";
echo "<val>". $line["item"] . "</val>";
echo "<val>". $line["image"] . "</val>";
}
echo "</items >";
This might work but if u can see i first fetch the items for a user, send them to my website(flashBased) then flash send for each item its id to php and retrieves its info
I was wondering is there a way to do all this all in 1 php file other than this way?:
$query = "SELECT * FROM userItems WHERE ID = '$userID' " ;
$results = mysql_query($query);
echo "xml=<?xml version=\"1.0\"?>";
echo "<items>";
while($line = mysql_fetch_assoc($results)){
$query2 = "SELECT * FROM userItems WHERE ID = '$userID' " ;
$results2 = mysql_query($query2);
echo "<item>";
while($line = mysql_fetch_assoc($results2)){
echo "<val>". $line["ID"] . "</val>";
echo "<val>". $line["item"] . "</val>";
echo "<val>". $line["image"] . "</val>";
}
echo "</item >";
}
echo "</items >";
Any suggestions or am i on the right track?