Jump to content

weird error


Eugene

Recommended Posts

[!--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:

[code]
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";
            }
[/code]

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]
Link to comment
Share on other sites

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

[code]<?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());
?>[/code]

Ken
Link to comment
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.