What potential pitfalls should be considered when allowing users to generate new addresses in a PHP application?

One potential pitfall when allowing users to generate new addresses in a PHP application is the risk of SQL injection attacks if the user input is not properly sanitized. To prevent this, always use prepared statements or parameterized queries when interacting with the database to avoid direct user input in SQL queries.

// Example of using prepared statements to insert a new address into the database

// Assuming $conn is the database connection

$userAddress = $_POST['user_address'];

$stmt = $conn->prepare("INSERT INTO addresses (address) VALUES (?)");
$stmt->bind_param("s", $userAddress);
$stmt->execute();
$stmt->close();