[RESOLVED] sql error maybe syntax issue maybe - Page 2
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 39

Thread: [RESOLVED] sql error maybe syntax issue maybe

  1. #16
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,428
    sneakyimp has already pointed out the issue:
    Quote Originally Posted by sneakyimp View Post
    if $reminder is non-numeric then you'll get a syntax error. you might want to put quotes around $reminder.
    Stated in another way: All string data in SQL queries must be surrounded (or "delimited") by single quotes.
    Share on Google+

  2. #17
    Senior Member
    Join Date
    Apr 2003
    Location
    Silver Lake
    Posts
    4,874
    Check your database table called users. Make sure it has all these fields. If it doesn't, there's your problem:
    * id
    * user_email
    * reminder

    The names have to match *exactly*. I.e., reminder is not the same thing as user_reminder.
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.
    Share on Google+

  3. #18
    Junior Member
    Join Date
    Mar 2012
    Posts
    20
    im testing it on a database with colume that does have a value and is not blank also testing the form with entered values aswel and the real value is getting printed correctly in the error output
    Share on Google+

  4. #19
    Junior Member
    Join Date
    Mar 2012
    Posts
    20
    the feild exists with correct data inside and that correct data is displayed correcly within the error output so its defenetly human error here on my part
    Share on Google+

  5. #20
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,428
    Hello? Is this thing on?

    Maybe you'll actually read my reply if I post it several times...

    Quote Originally Posted by sneakyimp View Post
    if $reminder is non-numeric then you'll get a syntax error. you might want to put quotes around $reminder.
    Quote Originally Posted by bradgrafelman View Post
    Stated in another way: All string data in SQL queries must be surrounded (or "delimited") by single quotes.
    Quote Originally Posted by sneakyimp View Post
    if $reminder is non-numeric then you'll get a syntax error. you might want to put quotes around $reminder.
    Quote Originally Posted by bradgrafelman View Post
    Stated in another way: All string data in SQL queries must be surrounded (or "delimited") by single quotes.
    Quote Originally Posted by sneakyimp View Post
    if $reminder is non-numeric then you'll get a syntax error. you might want to put quotes around $reminder.
    Quote Originally Posted by bradgrafelman View Post
    Stated in another way: All string data in SQL queries must be surrounded (or "delimited") by single quotes.
    Quote Originally Posted by sneakyimp View Post
    if $reminder is non-numeric then you'll get a syntax error. you might want to put quotes around $reminder.
    Quote Originally Posted by bradgrafelman View Post
    Stated in another way: All string data in SQL queries must be surrounded (or "delimited") by single quotes.
    Share on Google+

  6. #21
    Junior Member
    Join Date
    Mar 2012
    Posts
    20
    i have tried this aswell

    select id from `users` where (user_email = '$user_email' && `reminder` = `$user_reminder

    still same error!
    Share on Google+

  7. #22
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,428
    Two problems with that:
    1. You've got a single backtick before the $user_reminder value that isn't closed.
    2. Backticks are not single quotes, and single quotes are not backticks.
    Share on Google+

  8. #23
    Senior Member Derokorian's Avatar
    Join Date
    Apr 2011
    Location
    Denver
    Posts
    1,782
    Wow. QUOTES AROUND STRINGS which makes `$user_reminder wrong in OH SO many ways. First its not a quote, second it doesn't have a match its a single extraneous backtick O_o `reminder` = '$user_reminder'
    Sadly, nobody codes for anyone on this forum. People taste your dishes and tell you what is missing, but they don't cook for you. ~anoopmail
    I'd rather be a comma, then a full stop.
    User Authentication in PHP with MySQLi - Don't forget to mark threads resolved - MySQL(i) warning
    Share on Google+

  9. #24
    Junior Member
    Join Date
    Mar 2012
    Posts
    20
    tried also

    select id from `users` where (user_email = '$user_email' && reminder = `$user_reminder`)
    Share on Google+

  10. #25
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,428
    Guess I have to resort to the spamming method again...

    Quote Originally Posted by bradgrafelman View Post
    Backticks are not single quotes, and single quotes are not backticks.
    Quote Originally Posted by bradgrafelman View Post
    Backticks are not single quotes, and single quotes are not backticks.
    Quote Originally Posted by bradgrafelman View Post
    Backticks are not single quotes, and single quotes are not backticks.
    Quote Originally Posted by bradgrafelman View Post
    Backticks are not single quotes, and single quotes are not backticks.
    And at this point I'm just going to unsubscribe since it's obvious you're blindly mashing buttons on your keyboard rather than trying to engage your brain and take a moment to think. If you were doing the latter, for example, you might notice that this:

    Code:
    user_email = '$user_email'
    and this:
    Code:
    reminder = `$user_reminder`
    don't look alike, despite the fact that they're doing the exact same thing (comparing the value of a column with a string expression).
    Share on Google+

  11. #26
    Junior Member
    Join Date
    Mar 2012
    Posts
    20
    so how do i fix this as thiats the qwuestion i dont know and you think i know what you know all i know is what i have tryed and without you not giving a full string to try like my 1st post i cant test it to learn from it how it should be hope this helps
    Share on Google+

  12. #27
    Senior Member Derokorian's Avatar
    Join Date
    Apr 2011
    Location
    Denver
    Posts
    1,782
    Quote Originally Posted by Derokorian View Post
    Wow. QUOTES AROUND STRINGS which makes `$user_reminder wrong in OH SO many ways. First its not a quote, second it doesn't have a match its a single extraneous backtick O_o `reminder` = '$user_reminder'
    Or the shorter part which is just the droid you're looking for:
    Quote Originally Posted by Derokorian View Post
    `reminder` = '$user_reminder'
    Quote Originally Posted by Derokorian View Post
    `reminder` = '$user_reminder'
    Sadly, nobody codes for anyone on this forum. People taste your dishes and tell you what is missing, but they don't cook for you. ~anoopmail
    I'd rather be a comma, then a full stop.
    User Authentication in PHP with MySQLi - Don't forget to mark threads resolved - MySQL(i) warning
    Share on Google+

  13. #28
    Junior Member
    Join Date
    Mar 2012
    Posts
    20
    dont understand that reponse just need a line to paste ina dna ttempt so i can post a solved if not it remains unsolved!
    Share on Google+

  14. #29
    Junior Member
    Join Date
    Mar 2012
    Posts
    20
    think i solved it myself,

    select id from `users` where ((user_email = '$user_email') && ('$user_reminder' = reminder))
    Share on Google+

  15. #30
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,428
    In other words, you took the advice that was given in the very first reply to the thread?
    Share on Google+

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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