prepare("INSERT INTO users (name, email) VALUES (:name, :email)"); // Bind parameters to prevent SQL injection $stmt->bindParam(':name', $name); $stmt->bindParam(':email', $email); // Execute the query $stmt->execute(); echo "Data inserted successfully."; } catch (PDOException $e) { // Handle errors echo "Error: " . $e->getMessage(); } } ?>