View Single Post
Old 07-26-2011, 01:58 AM   PM User | #1
benji23
New Coder

 
Join Date: May 2011
Posts: 13
Thanks: 3
Thanked 0 Times in 0 Posts
benji23 is an unknown quantity at this point
Cool Rendering MySQL output to edit in a form

Im coding a form to upload items into MySQL database, everything works fine except when i click "edit" (to change details with that item) the data doesnt render in the form...

<?php
// Gather this product's full information for inserting automatically into the edit form below on page
if (isset($_GET['pid'])) {
$targetID = $_GET['pid'];
$sql = mysql_query("SELECT * FROM products WHERE id='$targetID' LIMIT 1");
$productCount = mysql_num_rows($sql); // count the output amount
if ($productCount > 0) {
while($row = mysql_fetch_array($sql)){

$product_name = $row["product_name"];
$price = $row["price"];
}
} else {
echo "Item doesnt exist!";
exit();
}
}
?>
benji23 is offline   Reply With Quote