Schlo_50 Posted November 28, 2007 Share Posted November 28, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/79243-getting-data-into-database/ Share on other sites More sharing options...
Schlo_50 Posted November 28, 2007 Author Share Posted November 28, 2007 any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/79243-getting-data-into-database/#findComment-401130 Share on other sites More sharing options...
Schlo_50 Posted November 28, 2007 Author Share Posted November 28, 2007 anybody? Quote Link to comment https://forums.phpfreaks.com/topic/79243-getting-data-into-database/#findComment-401278 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.