Joshie
WebHost Founder
- May 29, 2015
- 143
- 20
Hiya,
I ain't too good with MySQL
So I need a little bit of help here.
I get the following error when attempting to use the input forms to upload a news article to a panel (not a retro cms or anything, fansite panel)
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 '2', '1551388848')' at line 1
The Code:
Any help is appreciated.
I ain't too good with MySQL
So I need a little bit of help here.
I get the following error when attempting to use the input forms to upload a news article to a panel (not a retro cms or anything, fansite panel)
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 '2', '1551388848')' at line 1
The Code:
Code:
if( $_POST['submit'] ) {
try {
$title = $core->clean( $_POST['title'] );
$cat = $core->clean( $_POST['category'] );
$article = $core->clean( $_POST['article'] );
$desc = $core->clean( $_POST['desc'] );
$time = time();
if( !$title or !$article ) {
throw new Exception( "All fields are required." );
}
else {
if( $editid ) {
$db->query( "UPDATE news SET title = '{$title}', category = '{$cat}', article = '{$article}', desc = '{$desc}' WHERE id = '{$editid}'");
}
else {
$db->query( "INSERT INTO news VALUES ('0', '{$cat}', '{$title}', '{$article}', {$desc}', '{$user->data['id']}', '{$time}');" );
}
echo "<div class=\"mws-form-message success\">Success!<ul><li>Article successfully added!</li></ul></div>";
}
}
catch( Exception $e ) {
echo "<div class=\"mws-form-message error\">";
echo "Error";
echo "<ul><li>";
echo $e->getMessage();
echo "</li></ul></div>";
}
}
?>
Any help is appreciated.