Jump to content


Photo

weird error


  • Please log in to reply
1 reply to this topic

#1 Eugene

Eugene
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts

Posted 27 April 2006 - 10:04 PM

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]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 'desc, cat, banurl, id) VALUES('ggg', 'ggg', 'gfd@gfd.com',[/quote]

Code that triggers that is here:

if(validate_email($email)){

                mysql_query("
                INSERT INTO top
                (username, password, email, url, title, desc, cat, banurl, id) 
                VALUES('$username', '$password', '$email', '$url', '$title', '$desc', '$catergory', '$banner', '$sql')
                ")
                or die(mysql_error()); 
                echo "Congratulations, you are now a registered member";
            } 

The Variables are here:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]

$username = $_POST['username'];
$password = $_POST['password'];
$confirm = $_POST['confpass'];
$email = $_POST['email'];
$url = $_POST['url'];
$title = $_POST['title'];
$desc = $_POST['description'];
$catergory = $_POST['cat'];
$banner = $_POST['banurl'];
$submit = $_POST['submit'];[/quote]

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 27 April 2006 - 11:56 PM

The word "desc" is a reserved word, surround it with back ticks ( [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]`[!--colorc--][/span][!--/colorc--] )

<?php
mysql_query("
                INSERT INTO top
                (`username`, `password`, `email`, `url`, `title`, `desc`, `cat`, `banurl`, `id`)
                VALUES('$username', '$password', '$email', '$url', '$title', '$desc', '$catergory', '$banner', '$sql')
                ")
                or die(mysql_error()); 
?>

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users