Jump to content

Getting data into database


Schlo_50

Recommended Posts

Ok, this isn't meant to be a double post but i apologise if it comes accross that way!

 

I have a script which calls and displays items from my database, each item has a unique product id. The idea is that the user views the page full of items and clicks a checkbox or any efficient method (suggestions) to select one or more items they want to purchase. For each item they select i want the product id of each to be sent into my database into one field separated by commas. What i need for the next part of the script is some code which will work with the $ProductId's to do what i want it to.

 

Any help? Im seriously stuck and need some ideas about how to achieve my goal.

 

?php
$sql2 = odbc_exec($odbc, "SELECT * FROM Product1 ORDER BY CategoryName") or die (odbc_errormsg());

$prevCat='';
while($row = odbc_fetch_array($sql2))
{
$Category = $row["CategoryName"];
$ProductId = $row["ProductId"];
$ProductName = $row["ProductName"];
$Price = $row["Price"];

// has category changed
// if so, print it
if ($Category != $prevCat)  {
	echo "<h2>$Category</h2>";
}
echo  'Item Code: ', $ProductId, '<br/>Item Name:  ', $ProductName, '<br/><br/>Price: £', $Price, '<input name="code[]" type="text" size="2" /><br/><br/>';

$prevCat = $Category;
}
?>

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.