php - Weird behavior in database -
i have simple script inserts user's email, , posts table. works , it's inserting them incorrectly.
the script:
if (isset($_post["submit"]) == 1) { $posts = $_post["posts"]; $insert_post = $conn->prepare("insert posts (email, the_posts) values (:user_id, :posts)"); $insert_post->bindparam(":user_id", $_session["user_id"]); $insert_post->bindparam(":posts", $posts); $insert_post->execute(); echo "<script>alert('successfully posted!');</script>"; } $_session["user_id"] user's email. when submit post, email column gets post , post column displays email instead??
structure of database:
id int(11) auto_increment email varchar(255) latin1_swedish_ci the_posts archar(255) latin1_swedish_ci
Comments
Post a Comment