Jump to content

Hellz

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Hellz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. yes there both numbers ? just keep gettin the same error
  2. I get this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE ProductId =' at line 1 $quantity = $_POST['quantity']; $sql = "Update item SET Stock = STOCK - $quantity WHERE ProductId = $ProductId "; $result = mysql_query($sql) or die ( mysql_error() );?> thats the code im using. ProductId is the key field in the database table. is that right?
  3. hi, I want to update a selected fields in a database, the information i want to update comes from a form but i want it to decrease the value. What i mean is: The user inputs how many of a product they want and i want the stock field in the database to decrease by that many, any help? This is the current code im using but it increase the value not decrease. PHP Code: $quantity = $_POST['quantity']; $sql = "Update item (Stock) VALUES ('$quantity')"; $result = mysql_query($sql) or die ( mysql_error() );?>
  4. echo "<tr><td>$row[Artist]</td><td>$row[Album] </td><td>$row[Price]</td><td>$row[ProductDesc]</td><td><img src=$row[image] ><td><input type='text" /> <td><a href=\"cart.php?ProductId=$row[ProductId]\">Add Item</a></td> </tr>\n"; All im trying to do is add a simple text box in but it does work. any help would be appriciated! Sorry i have fixed it myself but dont know how to delete this thread
  5. that doesn't work, i just get a blank screen, no banner or navigation either. any other ideas?
  6. <?php $dbc = mysql_connect ('bbp.webcontrolcenter.com','****','****') OR die('Could not connect to MySQL : ' . mysql_error() ); mysql_select_db ('***') OR die('Could not select the database : ' . mysql_error() ); $Prodid = $_GET['ProductId']; $query = "SELECT * FROM item WHERE ProductId=$Prodid $result=do_query($query); $row= mysql_fetch_array($result); echo "Artist . " $row['Artist] . "<br/>"; echo "Album . " $row['Album'] . "<br/>"; ?> ^^ Thats the code i got atm to show the result on the cart page but it does not work.
  7. yea that works and transfers itas it says in the address bar. How do i then get it to display that item on the page?
  8. <?php $dbc = mysql_connect ('bbp.webcontrolcenter.com','****','****') OR die('Could not connect to MySQL : ' . mysql_error() ); mysql_select_db ('***') OR die('Could not select the database : ' . mysql_error() ); $query = "SELECT * FROM item WHERE sale='yes'"; $result = mysql_query ($query); ?> <table> <tr> <td ><strong>Artist Name</strong></td> <td ><strong>Album Name </strong></td> <td ><strong>Price </strong></td> <td ><strong>Product Description</strong></td> <td ><strong>Image</strong></td> <td ><strong>Add to Basket</strong></td> </tr> <?php while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { Echo "<tr><td>$row[Artist]</td><td>$row[Album] </td><td>$row[Price]</td><td>$row[ProductDesc]</td><td><img src=$row[image] /><td><"a href=cart.php?ProductId=$row[ProductId]">Add Item</a></td> </tr>\n"; } mysql_close(); ?> </table> ^^ that is all my current code
  9. <td><"a href=cart.php?ProductId=$row[ProductId]">Add Item</a></td> Im trying to get the above code to transfer data from one page to another. I have different items for sale on the sales page, the information comes from a database and i want it to transfer the data from a selected item onto the cart page. I thought the above code would put a link on the sale page saying Add item at the end of each item information that has been brought from the database. Then when the user clicks on the link it will take them to the cart page and i then want it to display the information for the item they selected. I was also wondering what the code would be that i would put on the cart page to show the information that i have transferred? Any help would be greatly appreciated
×
×
  • 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.