i get the following error can somebody help me?
this is the Error:
SQLSTATE[42000]: Syntax error or access violation: 1064 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 'WHERE pageID = '1'' at line 1
This is the code1:
<?php //include config
include("../init.php");
$FP->Auth->checkAuthorization();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bewerk Pagina</title>
<link href="<?php echo APP_RESOURCES; ?>css/fp_style.css" media="screen" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script type="text/javascript">$.noConflict();</script>
<script src="//tinymce.cachefly.net/4.0/tinymce.min.js"></script>
<script>
tinymce.init({
selector: "textarea",
plugins: [
"advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
"searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
"save table contextmenu directionality emoticons template paste textcolor"
],
content_css: "css/content.css",
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l ink image | print preview media fullpage | forecolor backcolor emoticons",
style_formats: [
{title: 'Bold text', inline: 'b'},
{title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
{title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
{title: 'Example 1', inline: 'span', classes: 'example1'},
{title: 'Example 2y', inline: '', classes: 'youtubeimg'},
{title: 'Table styles'},
{title: 'Table row 1', selector: 'tr', classes: 'tablerow1'},
{
title: 'Image Left',
selector: 'img',
styles: {
'float': 'left',
'margin': '0 10px 10px 10px',
'border': '1px solid #f60',
'border-radius':'5px'
}
}
]
});
</script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#fp_cancel, #fp_close').live('click', function(e){
e.preventDefault();
parent.jQuery.colorbox.close();
});
});
</script>
</head>
<body>
<div id="fp_wrapper">
<h1>Artikel Beheer
<div id="fp_close">Sluit Popup</div></h1>
<?php
//if form has been submitted process it
if(isset($_POST['submit'])){
$_POST = array_map( 'stripslashes', $_POST );
//collect form data
extract($_POST);
//very basic validation
if($pageID ==''){
$error[] = 'This post is missing a valid id!.';
}
if($pageTitle ==''){
$error[] = 'Please enter the title.';
}
if($pageText ==''){
$error[] = 'Please enter the description.';
}
if(!isset($error)){
try {
//insert into database
$stmt = $db->prepare('UPDATE page SET pageTitle = :pageTitle, pageText = :pageText, WHERE pageID = :pageID') ;
$stmt->execute(array(
':pageTitle' => $pageTitle,
':pageText' => $pageText,
':pageID' => $pageID
));
//redirect to index page
header('Location: page.php?action=updated');
exit;
} catch(PDOException $e) {
echo $e->getMessage();
}
}
}
?>
<?php
//check for any errors
if(isset($error)){
foreach($error as $error){
echo $error.'<br />';
}
}
try {
$stmt = $db->prepare('SELECT pageID, pageTitle, pageText FROM page WHERE pageID = :pageID') ;
$stmt->execute(array(':pageID' => $_GET['id']));
$row = $stmt->fetch();
} catch(PDOException $e) {
echo $e->getMessage();
}
?>
<form action='' method='post'>
<input type='hidden' name='pageID' value='<?php echo $row['pageID'];?>'>
<p>
<label>Titel</label><br /><br />
<input type='text' name='pageTitle' value='<?php echo $row['pageTitle'];?>'></p>
<p>
<br /><label>Pagina Tekst</label><br /><br />
<textarea name='pageText' cols='60' rows='10'><?php echo $row['pageText'];?></textarea></p>
<br />
<p><input type='submit' name='submit' value='Wijzigen'></p> <p><INPUT TYPE="button" VALUE="Terug" onClick="history.go(-1);"></p><br />
</form>
<br /></div>
</body>
</html>
If anybody see the problem please show me a example
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment