Log In · Register

 
Help!, Php & Mysql problem
nightmareutopia
post Feb 9 2008, 11:30 PM
Post #1


Newbie
*

Group: Member
Posts: 8
Joined: Nov 2007
Member No: 592,112



So my code is:

CODE
<?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';
?>


The error-
Parse error: syntax error, unexpected $end in _____ on line 35

How can i fix that?
 
 
Start new topic
Replies
libertie
post Feb 12 2008, 07:54 PM
Post #2


This bag is not a toy.
*******

Group: Staff Alumni
Posts: 3,090
Joined: Oct 2007
Member No: 583,108



If it helps, line 35 is where your document ends:

?>

It may be a problem with the line before that, the include statement. What happens if you take it out?

I think it would help if I had more information. What type of site is this for (what type of content management system, etc.)?

Would you mind posting a link?
 

Posts in this topic


Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: