Hi Steve,

you will need to use mysql_fetch_* on the result (where * might be object,
row, array, assoc):

$query = "SELECT * FROM products WHERE
ItemCode='$ItemCode'";
$result = mysql_query($query)
    // for debug
    or die("Error in query "$query". MySQL said: " .
mysql_error());
$row = mysql_fetch_assoc($result);

Then the form:
<form action="eshop_editprodprocess.php" method="post">
<input type="text" name="ItemName" value="<?php echo
htmlentities($row['ItemName']); ?>" size="18"
class="kapea">
<input type="text" name="ItemCode" value="<?php echo
htmlentities($row['ItemCode']); ?>size="18"
class="kapea">
<input type="text" name="ItemDesc" value="<?php echo
htmlentities($row['ItemDesc']); ?>" size="18"
class="kapea">
</form>

Check the manual for more details.

James

"Steve Jackson" <[EMAIL PROTECTED]> wrote in message
002b01c2a128$8c367c60$[EMAIL PROTECTED]">news:002b01c2a128$8c367c60$[EMAIL PROTECTED]...
> I am having problems populating form fields. Here is my code:
> //$ItemCode is passed to the page with this code
> $mysql = mysql_query("SELECT * FROM products WHERE
> ItemCode='$ItemCode'");
> $result = mysql_query($mysql);
>
> Then the form:
> <form action="eshop_editprodprocess.php" method="post">
> <input type="text" name="ItemName" value="<?=$ItemName;?>" size="18"
> class="kapea">
> <input type="text" name="ItemCode" value="<?=$ItemCode;?>" size="18"
> class="kapea">
> <input type="text" name="ItemDesc" value="<?=$ItemDesc;?>" size="18"
> class="kapea">
> </form>
>
> I have tried numerous ways to use $result to get these values to appear
> but am stuck. How therefore do I select everything from the database
> sorted by ItemCode and then displayed in a form as shown above.
>
> Regards,
>
> Steve Jackson
> Web Developer
> Viola Systems Ltd.
> http://www.violasystems.com
> [EMAIL PROTECTED]
> Mobile +358 50 343 5159
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to