Jump to content

vet911

Members
  • Posts

    100
  • Joined

  • Last visited

Community Answers

  1. vet911's post in I have trouble sending data to database using PDO, any help would be appreciated. was marked as the answer   
    Hi, I found out the problem, the error was generating and shown at the bottom of the page. I have sense figured out that the password was incorrect. I changed that and now it works. I want to correct the script so it's not supplying directly to the database as mentioned in the reply from "benanamen" but not sure how to do that. Do I have to remove the script from the form page and have the form call the script to insert the data to the database?
    I have done this before but not recently. Any help would be appreciated. Thanks to all who replied.
  2. vet911's post in Need some help with pdo update to database was marked as the answer   
    $getid = $_POST['id']; $getitemno = $_POST['itemno']; $getavailability = $_POST['availability']; // Connect to server and select database. try { echo "$getitemno"; // UPDATE data $sql = "UPDATE cut_stones SET itemno= :itemno, availability= :availability WHERE id= :id"; $stmt = $dbh->prepare($sql); $stmt->bindParam(':id', $_POST['id'], PDO::PARAM_INT); $stmt->bindParam(':itemno', $_POST['itemno'], PDO::PARAM_STR); $stmt->bindParam(':availability', $_POST['availability'], PDO::PARAM_INT); $stmt->execute(); } catch(PDOException $e) { echo $e->getMessage(); } // if successfully updated. $dhb = null; echo " Updated"; I figured it out. I have listed the code above.
    Thanks for the help.
×
×
  • 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.