Welcome to Welcome to DNF.com™ - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars

If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.

Register Today on DNForum IT'S FREE!

Results 1 to 8 of 8
  1. #1
    Platinum Lifetime Member

    Join Date
    Sep 2003
    Location
    Connecticut
    Posts
    79
    DNF$
    510
    Bank
    0
    Total DNF$
    510
    Donate  

    MySQL Error - Please Help

    Hi,

    When a user signs up for my image Hosting service they

    UPDATE users SET name='ZOMG, it's Cynn', username='usersemail@email.com' , password='their_password', email='usersemail@email.com' WHERE other_id='2341' 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 's Cynn', username='usersemail@email.com', in line #317

  2. #2
    President
    GiantDomains's Avatar
    Join Date
    Sep 2002
    Location
    N-Y-C
    Posts
    6,729
    DNF$
    573
    Bank
    0
    Total DNF$
    573
    Donate  

    Re: MySQL Error - Please Help

    Check line 317
    NETCHEAP - Discount Dotster Reseller - $7.99
    FREE pushes from your dotster account, renew for $7.99! 1. Create a netcheap account. 2. Push from dotster to netcheap account name. 3. Renew for $7.99!

  3. #3
    The One
    VisualDigits's Avatar
    Join Date
    Mar 2005
    Location
    New Jersey
    Posts
    1,917
    DNF$
    1,210
    Bank
    0
    Total DNF$
    1,210
    Donate  

    Re: MySQL Error - Please Help

    You have an apostrophe in name='ZOMG, it's Cynn', you gotta use double quotes i.e. name="ZOMG, it's Cynn". Enjoy!
    Cogito, ergo sum!

  4. #4
    DNF Addict

    Join Date
    Apr 2003
    Location
    USA
    Posts
    1,481
    DNF$
    15,602
    Bank
    0
    Total DNF$
    15,602
    Donate  

    Re: MySQL Error - Please Help

    Quote Originally Posted by DomainMaster
    You have an apostrophe in name='ZOMG, it's Cynn', you gotta use double quotes i.e. name="ZOMG, it's Cynn". Enjoy!
    This would work as long as you know they are going to use a single quote, but because you don't know whether the user is going to to use a single quote in their name or even a double quote: (i.e., Sam "the Man"), it's best to simply escape the variable...
    Code:
    name='".addslashes($name))."',
    ... or (less desirable), replace any single quotes with double single quotes..
    Code:
    name='".str_replace("'", "''", $name).",
    Sam
    --
    I'm just waiting 'til the shine wears off.

  5. #5
    Platinum Lifetime Member

    Join Date
    Sep 2003
    Location
    Connecticut
    Posts
    79
    DNF$
    510
    Bank
    0
    Total DNF$
    510
    Donate  

    Re: MySQL Error - Please Help

    If Someone would like to earn $3 via PayPal to fix this PM me.

    Thanks,
    --Brian R.

  6. #6
    www.LOL.biz
    Bender's Avatar
    Join Date
    Apr 2004
    Location
    .ro
    Posts
    1,912
    DNF$
    6,243
    Bank
    0
    Total DNF$
    6,243
    Donate  

    Re: MySQL Error - Please Help

    Code:
    UPDATE users SET name='ZOMG, it\'s Cynn', username='usersemail@email.com' , password='their_password', email='usersemail@email.com' WHERE other_id='2341'

  7. #7
    JuniperPark's Avatar
    Join Date
    Aug 2003
    Location
    San Diego, CA
    Posts
    3,154
    DNF$
    5,974
    Bank
    0
    Total DNF$
    5,974
    Donate  

    Re: MySQL Error - Please Help

    Not sure about MySQL, but in MS SQL it's this:

    UPDATE users SET name='ZOMG, it''s Cynn', username='usersemail@email.com' , password='their_password', email='usersemail@email.com' WHERE other_id='2341'

    All incoming text MUST be protected by doubling any quotes (it will be a single quote in the DB.

    Code:
    name = replace(name,''','''')

    If other_id is numeric you don't use quotes.
    The only domain reseller BRAVE enough to post prices: TheNameStore.com ][

  8. #8
    DNF Addict

    Join Date
    Apr 2003
    Location
    USA
    Posts
    1,481
    DNF$
    15,602
    Bank
    0
    Total DNF$
    15,602
    Donate  

    Re: MySQL Error - Please Help

    JuniperPark, IT Web Team, DomainMaster and myself have all answered your question: You have to deal with the possibility of a single quote in your form.

    If you still need help, PM me your source code relating to the construction of the SQL statement, and I will send it back showing you where to escape the value to avoid this faux pas.

    If your code is too large for PM you can email me at domains at diverge dot com.
    Sam
    --
    I'm just waiting 'til the shine wears off.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Domain name forum recommended by Domaining.com