SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2006
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    getting mysql error during query

    im getting an error during a query...i need some help troubleshooting..

    here is the code:

    PHP Code:
    $step2 = @mysql_query("INSERT INTO clublist SET name='$name', pnotes='$pnotes', pres='$pres', hashed='$upass', adv='$adv', pemail='$pmail', timestamp='$stamp', aemail='$amail', email='$clubmail', dues='$dues', payloc='$ploc', payable='$payable', website='$website', user='$user', pass='$pass', school='$school', notif='1'");
            if (
    $step2) {
            
    $cid mysql_insert_id();
            
    $default = @mysql_query("INSERT INTO clubmember SET club='$cid', member='0'");
            if (
    $default) {
                echo 
    "<div class='bodytext'>-- $name"; }
            } else {
            exit(
    'Error verifying club' mysql_error()); } 

    here is the error:

    Error verifying clubYou 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 transcript to the check as we accept membership on a competiti
    the text in the error corresponds to "$pnotes" in line 2 of the code.

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    put your sql query into a variable, so you can echo it and look at what your sending to mysql.

  3. #3
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It appears to be a problem because of quotes, use mysql_real_escape_string() on all values.
    Saul

  4. #4
    SitePoint Zealot sajjad's Avatar
    Join Date
    May 2005
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    remove @ sign and then check the result
    If you lose your patience you lose half of battle

  5. #5
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    please use either of these functions with all of the text inputs variables
    addslashes
    mysql_escape_string
    mysql_real_escape_string

    Regards.


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
  •