Ok, I believe I have now got a working array via the following:
$query = "SELECT * FROM orderItems o, items i
WHERE o.itemID = i.itemID
AND o.orderID = '$_POST[orderID]'";
if ($result = mysql_query($query)) {
$data = array();
while ($myrow = mysql_fetch_assoc($result)) {
$data[] = $result;
}
}
else {
//some query problem
exit(mysql_error());
}
print_r($myrow);
[code=php]
This displays individual items from two tables in a mysql database.
The "print_r" function displays the information as:
Array ( [orderItemID] => 633 [orderID] => 466 [itemID] => 494 [quantity]
etc, and it is displaying the correct information and number of items.
Now, how would I go about re-inserting this information? What I need to do is take those item results and re-enter them into the database via a submit button.
So, a person views the items displayed, then hits a submit button which would then essentially duplicate the items (with new auto-increment numbers).
Does that make sense?
P.S. Also! I tried using the following method from another post, but for some reason, it will only display the first character from a field. Thus, if there were 2 items called "Computer" and "Price" it would display just "C" and "1"... very odd.
for ($i=0; $i<count($FIRST); $i++) {
if ($i == 0)
$sql .= "('$SCHOOLID[$i]', '$GRADE[$i]', '$ROOM[$i]', '$MPSID[$i]', '$LAST[$i]', '$FIRST[$i]', '$SCORE1[$i]', '$SCORE2[$i]', '$SCORE3[$i]', '$SCORE4[$i]')";
else
$sql .= ", ('$SCHOOLID[$i]', '$GRADE[$i]', '$ROOM[$i]', '$MPSID[$i]', '$LAST[$i]', '$FIRST[$i]', '$SCORE1[$i]', '$SCORE2[$i]', '$SCORE3[$i]', '$SCORE4[$i]')";
}
Thanks for your assistance,
B