Hi, I have a field for postcode/ZIP address and I am trying to retrieve the postcode held in the database for a certain customer. I think the problem may be that I am using mysql_fetch_array when I should be using something different?.
The code & error are below:
CODE:
<p><b>postcode:</b> <input type="text" name="postcode" size="40" maxlength="40" />
<?php // Retrieve the postcode and add to field.
$query = "SELECT postcode FROM customer WHERE customer.customer_id = {$_SESSION['customer_id']}";
$result = @ ($query);
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
echo "<input type=\"text\" name=\"postcode\" size=\"40\" maxlength=\"40\" value=\"{$row['customer_id']}\">{$row['postcode']}/>\n";
}
?>
ERROR:
mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Thanks