Error when apostrophe is put on status
<p>I'm making something now that involves users putting statuses, but whenever a user puts a status with an apostrophe or double quotes, they get errors.</p>

<p>Can anyone help? Thanks!
p.s "Your post does not have much context to explain the code sections; please explain your scenario more clearly."</p>

<p>my get-posts.php</p>

<pre><code>&lt;?php

require('database/connect.php');

$result = mysql_query("SELECT * FROM posts ORDER BY date DESC");

while($row = mysql_fetch_array($result)) {

$email = $row['email'];

// To find username

$username = mysql_query("SELECT name FROM users WHERE email = '$email'");

$name = mysql_fetch_assoc($username);

// To make the date look prettier

$id = $row['id'];

$date_get = mysql_query("SELECT date FROM posts WHERE id='$id'");

$time = mysql_fetch_assoc($date_get);

$mysqldate = $time['date'];

$phpdate = strtotime( $mysqldate );

$DayMonthDay = date('l, F j', $phpdate);

$HourMinutePMAM = date('g:ia', $phpdate);

$date = $DayMonthDay." at ".$HourMinutePMAM;

echo "&lt;div class='home-echoed-posts'&gt;";

echo "&lt;a href='#' class='home-echoed-posts-name'&gt;".$name['name']."&lt;/a&gt; ";

echo "&lt;div class='home-echoed-posts-post'&gt;".nl2br(stripslashes($row['post']))."&lt;/div&gt;";

echo "&lt;div class='home-echoed-posts-date'&gt;".$date."&lt;/div&gt;";

echo "&lt;/div&gt;";

} 



?&gt;
</code></pre>

<p>and post.php:</p>

<pre><code>&lt;?php
session_start();
require('database/connect.php');

if(empty($_POST['post'])){
    header('Location: home.php');
    }

$post = $_POST['post'];

$useremail =  $_SESSION['email'];

$result = mysql_query("INSERT INTO posts (post, email) VALUE ('$post', '$useremail')");

if($result==1) {
    header('Location: home.php');
    }else{
    die('We have experienced some technical problems, please try again');
    }
?&gt;
</code></pre>
