thedigicraft / Atom.CMS

Atom.CMS
56 stars 50 forks source link

problems with the update page #28

Closed JSMendes closed 10 years ago

JSMendes commented 10 years ago

Hello, i'm having problems in the save page, get following error:

Page could not be updated because: 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 (...).

I already put this:

if (isset($_POST['id']) && $_POST['id'] != '') {

but the error still gos on.. can you help me pls?

thedigicraft commented 10 years ago

Hello,

Could you post the code for that whole page here? That would help me find the error.

JSMendes commented 10 years ago

index.php

<?php

Start the Session:

session_start();

if(!isset($_SESSION['username'])) { header('Location: login.php'); }

?>

<?php include('config/setup.php'); ?>

<!DOCTYPE html>

``` <?php echo $page['title']. ' | ' .$site_title; ?>

Admin Dashboard

Page was added!

'; } else { $message = '

Page could not be added because: '.mysqli_error($dbc); $message .= '

'.$q.'

'; } } ?>
```
JSMendes commented 10 years ago

I already put the code in the GutHub, can you help me?

2014-04-24 21:35 GMT+01:00 The Digital Craft notifications@github.com:

Hello,

Could you post the code for that whole page here? That would help me find the error.

— Reply to this email directly or view it on GitHubhttps://github.com/thedigicraft/Atom.CMS/issues/28#issuecomment-41328793 .

phpclue commented 10 years ago

Try replacing:

if (isset($_POST['id']) && $_POST['id'] != '') { //Salva a página

With this:


if(isset($_POST['id']) != ""){ //Salva a página

Make sure there is no space between the double quotes -

 != ""){ //Salva a página

The way you have it may also work with double quotes instead of single quotes.

phpclue commented 10 years ago

You're missing a single quote after:

 label = '$label',

Try this:

if(isset($_POST['id']) != ""){ //Salva a página
     $q = "UPDATE pages SET user = $_POST[user], slug = '$slug', label = '$label', title = '$title', header = '$header', body = '$body' WHERE id = $_GET[id]";
JSMendes commented 10 years ago

Many thanks for the help PHPCLUE, I was already going crazy searching for the problem and were actually single quote ... omg very bad on my part, lack of attention = /

thedigicraft commented 10 years ago

Hey thanks PHPCLUE! I have been extremely busy over the last couple weeks. I appreciate your help with this! :-)