What potential pitfalls should be considered when storing Facebook user data in a database using PHP?

One potential pitfall when storing Facebook user data in a database using PHP is the risk of SQL injection attacks if user input is not properly sanitized. To prevent this, you should always use prepared statements or parameterized queries to securely interact with the database.

// Using prepared statements to prevent SQL injection
$stmt = $pdo->prepare("INSERT INTO users (facebook_id, name, email) VALUES (:facebook_id, :name, :email)");
$stmt->bindParam(':facebook_id', $facebook_id);
$stmt->bindParam(':name', $name);
$stmt->bindParam(':email', $email);
$stmt->execute();