You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mollis mollis enim. Donec quis ante dui. Sed bibendum mollis massa, a mattis dia' at line 1
This only happens when I place a ' within my text. I do not understand what I am doing wring or how to fix this, I need it fixed for people to use.
For anyone who wants to test this, here is a like and the login info is:
Username: test
Password: test
http://journal.jae-entertainment.we.bs/test/
PHP processing the post:
Code: Select all
<?php
$entrytitle = $_POST['entrytitle'];
$entrylink = $_POST['entrylink'];
$entrybody = $_POST['entrybody'];
function filterFunction ($var) {
$var = eregi_replace("'", "'", $var);
return $var;
}
$entrytitle = filterFunction($entrytitle);
$entrylink = filterFunction($entrylink);
$entrybody = filterFunction($entrybody);
include_once "include/connect.php";
$query = mysqli_query($myConnection, "INSERT INTO test (entrytitle, entrylink, entrybody, lastmodified)
VALUES('$entrytitle','$entrylink','$entrybody',now())") or die (mysqli_error($myConnection));
echo 'Operation Completed Successfully! <br /><br /><a href="index.php">Click Here</a>';
exit();
?>