Jump to content

Recommended Posts

I keep getting this error:

 

1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Query WHERE 'level_id' = 1' at line 1

 

I dont know whats wrong. Here is my code:

 

<?php
    require_once("inc/db.inc.php");
    require_once ("files/levels.php");
if ($_COOKIE['uniqueid']) {
?>
<?php
    $a = $_COOKIE['access'];
global $levels;
    if ($a <= $levels[levels]) {
            $input = $_POST['submit'];
            if ($_POST['submit']) { // Check to see if something has been 'posted' from the form by checking to see if the submit button was sent
            echo $_REQUEST['dropdown']; // Display the VALUE of the 'dropdown' select item.
            MYSQL_QUERY("UPDATE `cp_levels` SET `level_id` = 1, `news` = $input WHERE 'level_id' = 1") or die (mysql_error());
            }
            echo "<form name='form1' action='#' method='POST'>";
            echo "<SELECT NAME='dropdown'>";
            echo "<OPTION VALUE='1'>Admin</option>";
            echo "<OPTION VALUE='2'>Staff</option>";
            echo "<OPTION VALUE='3'>Member</option>";
            echo "</SELECT>";
            echo "<br><br><input type='submit' name='submit'>";
            echo "</form>";
    	}
?>
<?php
        }
?>

<?php
    if ($a > $levels[levels]) {
            if (!$_REQUEST['m']) {
                getHeader();
                echo "Sorry, you dont have access to this page!";
            }
        }
?>

Link to comment
https://forums.phpfreaks.com/topic/67292-help-please/
Share on other sites

hmm, i did that, but then nothing in the db updates  :-\

 

My db is this :

 

  `level_id` int(11) NOT NULL auto_increment,
  `title` varchar(20) NOT NULL default '',
  `login` int(2) NOT NULL default '0',
  `home` int(2) NOT NULL default '0',
  `news` int(2) NOT NULL default '0',
  `roster` int(2) NOT NULL default '0',
  `links` int(2) NOT NULL default '0',
  `leagues` int(2) NOT NULL default '0',
  `matches` int(2) NOT NULL default '0',
  `servers` int(2) NOT NULL default '0',
  `sponsors` int(2) NOT NULL default '0',
  `downloads` int(2) NOT NULL default '0',
  `media` int(2) NOT NULL default '0',
  `demos` int(2) NOT NULL default '0',
  `settings` int(2) NOT NULL default '0',
  `pass` int(2) NOT NULL default '0',
  `users` int(2) NOT NULL default '0',
  `poll` int(2) NOT NULL default '0',
  `layout` int(2) NOT NULL default '0',
  `levels` int(2) NOT NULL default '0',
  `pages` int(2) NOT NULL default '0',

Link to comment
https://forums.phpfreaks.com/topic/67292-help-please/#findComment-337605
Share on other sites

<?php
    require_once("inc/db.inc.php");
    require_once ("files/levels.php");
if ($_COOKIE['uniqueid']) {
?>
<?php
    $a = $_COOKIE['access'];
global $levels;
    if ($a <= $levels[levels]) {
            $input = $_POST['dropdown'];
            if ($_POST['submit']) { // Check to see if something has been 'posted' from the form by checking to see if the submit button was sent
            echo $_REQUEST['dropdown']; // Display the VALUE of the 'dropdown' select item.
            MYSQL_QUERY("UPDATE `cp_levels` SET `level_id` = 1, `news` = '$input' WHERE 'level_id' = 1") or die (mysql_error());
            }
            echo "<form name='form1' action='#' method='POST'>";
            echo "<SELECT NAME='dropdown'>";
            echo "<OPTION VALUE='1'>Admin</option>";
            echo "<OPTION VALUE='2'>Staff</option>";
            echo "<OPTION VALUE='3'>Member</option>";
            echo "</SELECT>";
            echo "<br><br><input type='submit' name='submit'>";
            echo "</form>";
    	}
?>
<?php
        }
?>

<?php
    if ($a > $levels[levels]) {
            if (!$_REQUEST['m']) {
                getHeader();
                echo "Sorry, you dont have access to this page!";
            }
        }
?>

Link to comment
https://forums.phpfreaks.com/topic/67292-help-please/#findComment-341001
Share on other sites

MYSQL_QUERY("UPDATE `cp_levels` SET `level_id` = 1, `news` = '$input' WHERE 'level_id' = 1")

remove the ' ' in the level_id  this is a field so i guess no need for that ''

 

try

MYSQL_QUERY("UPDATE `cp_levels` SET `level_id` = 1, `news` = '".$input."' WHERE level_id = 1");

Link to comment
https://forums.phpfreaks.com/topic/67292-help-please/#findComment-341005
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.