I am getting the error:
Unknown column 'testetesttetete' in 'field list'
"testetesttetete" is what i put in for page title
This is my code:
<?php
require_once('../includes/DbConnector.php');
require_once('../includes/Validator.php');
$connector = new DbConnector();
$validator = new Validator();
// DELETE SECTIONS //
if ($HTTP_GET_VARS['action'] == 'delete'){
$sectionID = $HTTP_GET_VARS['ID'];
if ( $validator->validateNumber($sectionID,'Section ID') ){
$connector->query('DELETE FROM cmssections WHERE ID = '.$sectionID);
echo 'Section Deleted.<br>';
}else{
echo "Couldn't delete. There was a problem with: ".$validator->listErrors();
}
}
// ADD SECTION //
if ($HTTP_GET_VARS['action'] == 'add'){
$validator->validateTextOnlyNoSpaces($HTTP_POST_VARS['name'],'section name');
$validator->validateNumber($HTTP_POST_VARS['parent'],'parent section');
$validator->validateTextOnlyNoSpaces($HTTP_POST_VARS['pagetitle'],'pagetitle section');
if (!$validator->foundErrors()){
$connector->query('INSERT INTO cmssections (name,parentid,pagetitle) VALUES ('.$HTTP_POST_VARS['name'].','.$HTTP_POST_VARS['parent'].','.$HTTP_POST_VARS['pagetitle'].')') or die ('ERROR: '.mysql_error());
}else{
echo '<b>Please correct '.$validator->listErrors().'</b><br><br>';
}
}
// LIST SECTIONS //
$result = $connector->query('SELECT ID,name,parentid FROM cmssections');
while ($row = $connector->fetchArray($result)){
echo $row['name'].' - '; // Show the name of section
echo '<a href="editSections.php?action=delete&id='.$row['ID'].'"> Delete </a>'; // Show the delete link
echo '<br>'; // Show a carriage return
}
?>