Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- session_start();
- $servername = "localhost";
- $username = "root";
- $password = "root";
- $dbname = "somedatabase";
- try {
- $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
- // set the PDO error mode to exception
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- // prepare sql and bind parameters
- $stmt = $conn->prepare("INSERT
- INTO
- patients
- ( comments )
- VALUES
- ( :comment )
- WHERE
- unique_id = :unique_id
- ");
- $stmt->bindParam( ':comment', $comment );
- $stmt->bindParam( ':unique_id', $unique_id );
- $comment = $_POST[ 'comment' ];
- $unique_id = $_SESSION[ 'unique_id' ];
- $stmt->execute();
- //header('Location: newMedicine.php');
- }
- catch(PDOException $e)
- {
- echo "Error: " . $e->getMessage();
- }
- $conn = null;
- $comment = $_POST[ 'comment' ];
- $unique_id = $_SESSION[ 'unique_id' ];
Add Comment
Please, Sign In to add comment