MonkeyRanFromYou
02-10-2008, 02:23 AM
SO it's supposed to submit articles to a database... Problem is I keep getting various errors (currently: Parse error: syntax error, unexpected $end in /home/stuynet/public_html/cmsadmin/new_article.php on line 34 ).
Can someone please, please help me with it?
<?php
// Acquire Settings
require_once('../includes/DbConnector.php');
// Check whether a form has been submitted. If so, carry on
if ($HTTP_POST_VARS){
// Create a new instance of DbConnector
$connector = new DbConnector();
// Form Validation
// Create an SQL query
$insertQuery = "INSERT INTO articles (article_title,author_name,category,article_text) VALUES (".
"'".$HTTP_POST_VARS['article_title']."', ".
"'".$HTTP_POST_VARS['author_name']."', ".
$HTTP_POST_VARS['category'].", ".
"'".$HTTP_POST_VARS['article_text']."')
// Insert the data obtained from the form into the databse
if ($result = $connector->query($insertQuery)){
// If it worked then...
echo '<center><b>Article added to the database</b></center><br>';
}else{
// If it hasn't worked...
exit('<center>Sorry, there was an error in saving to the database.</center>');
}
include '../html/forms/news_insert_form.html';
?>
Can someone please, please help me with it?
<?php
// Acquire Settings
require_once('../includes/DbConnector.php');
// Check whether a form has been submitted. If so, carry on
if ($HTTP_POST_VARS){
// Create a new instance of DbConnector
$connector = new DbConnector();
// Form Validation
// Create an SQL query
$insertQuery = "INSERT INTO articles (article_title,author_name,category,article_text) VALUES (".
"'".$HTTP_POST_VARS['article_title']."', ".
"'".$HTTP_POST_VARS['author_name']."', ".
$HTTP_POST_VARS['category'].", ".
"'".$HTTP_POST_VARS['article_text']."')
// Insert the data obtained from the form into the databse
if ($result = $connector->query($insertQuery)){
// If it worked then...
echo '<center><b>Article added to the database</b></center><br>';
}else{
// If it hasn't worked...
exit('<center>Sorry, there was an error in saving to the database.</center>');
}
include '../html/forms/news_insert_form.html';
?>
