Results 1 to 5 of 5

Thread: user name with hyphen causing error

  1. #1
    Junior Member rfsforums's Avatar
    Join Date
    Sep 2010
    Posts
    20
    Thanks
    1
    Thanked 43 Times in 12 Posts

    Default user name with hyphen causing error

    when this user tries to access the storefront he's getting the following error:
    1064 - 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 'Regan' where customers_id = '893'' at line 1

    update osc_customers set customers_username = 'Barry O'Regan' where customers_id = '893'

    [TEP STOP]

    when I remove the hyphen it works fine.

    Any ideas for a fix other than chaging his name?

    Thanks!
    David

  2. The Following 3 Users Say Thank You to rfsforums For This Useful Post:

    itojessosaspos (23-11-2012),kescotekosek (03-11-2013),lrybuywejewe (26-08-2013)

  3. #2
    Developer Greystoke's Avatar
    Join Date
    Mar 2010
    Posts
    187
    Thanks
    2
    Thanked 499 Times in 113 Posts

    Default

    Hi,

    Sorry about this.

    You will need to edit your shop/includes/application_top.php

    Find around line 525:

    PHP Code:
     $check_customer_query tep_db_query("select customers_firstname, customers_default_address_id from " TABLE_CUSTOMERS "  where customers_id = '"$usersid ."'"); 
    Add before it:

    PHP Code:
    $customers_gender 'm';
    $customers_default_address_id '0';
    $customers_newsletter '1'
    Find around line 528:

    PHP Code:
      tep_db_query("insert into " TABLE_CUSTOMERS " (customers_id, customers_username, customers_gender, customers_firstname, customers_email_address, customers_default_address_id, customers_newsletter) VALUES ('$usersid', '$vbusername', 'm', '$vbusername', '$vbemail', '0', '1')"); 
    Replace with:

    PHP Code:

          $sql_data_array 
    = array('customers_id' => $usersid,
                                  
    'customers_username' => $vbusername,
                                  
    'customers_gender' => $customers_gender,
                                  
    'customers_firstname' => $vbusername,
                                  
    'customers_email_address' => $vbemail,
                                  
    'customers_default_address_id' => $customers_default_address_id,
                                  
    'customers_newsletter' => $customers_newsletter);
                      
          
    tep_db_perform(TABLE_CUSTOMERS$sql_data_array); 
    Find around line 576:

    PHP Code:
      tep_db_query("update " TABLE_CUSTOMERS " set customers_username = '" $vbusername "' where customers_id = '" $usersid "'"); 
    Replace with:

    PHP Code:
          $sql_data_array = array('customers_username' => $vbusername);    
        
          
    tep_db_perform(TABLE_CUSTOMERS$sql_data_array'update'"customers_id = '" $usersid "'"); 

  4. The Following 4 Users Say Thank You to Greystoke For This Useful Post:

    ciojennacgalac (16-12-2012),itojessosaspos (23-11-2012),kescotekosek (03-11-2013),lrybuywejewe (26-08-2013)

  5. #3
    Junior Member rfsforums's Avatar
    Join Date
    Sep 2010
    Posts
    20
    Thanks
    1
    Thanked 43 Times in 12 Posts

    Default

    Thanks for getting back so quickly.

    I made the changes but when I uploaded the file I got this error message:
    PHP Code:
    Warning: require(packages/shop/includes/languages//FILENAME_DEFAULT) [function.require]: failed to open stream: No such file or directory in [path]/ :) /shop/shop.php on line 52

    Warning: require(packages/shop/includes/languages//FILENAME_DEFAULT) [function.require]: failed to open stream: No such file or directory in [path]/ :) /shop/shop.php on line 52

    Fatal error: require() [function.require]: Failed opening required 'packages/shop/includes/languages//FILENAME_DEFAULT' (include_path='.:/usr/lib/php:/usr/local/lib/php'in / :) / :) / :) / :) / :) /shop/shop.php on line 52 
    I'm wondering since I have the hide products from usergroups mod that maybe something was missed? If you need access again just let me know.
    Thanks

  6. The Following 4 Users Say Thank You to rfsforums For This Useful Post:

    ciojennacgalac (16-12-2012),itojessosaspos (23-11-2012),kescotekosek (03-11-2013),lrybuywejewe (26-08-2013)

  7. #4
    Developer Greystoke's Avatar
    Join Date
    Mar 2010
    Posts
    187
    Thanks
    2
    Thanked 499 Times in 113 Posts

    Default

    Hi,

    I have made the chances to your 'shop/includes/application_top.php', using the above code I posted.

    Can you test it and let me know if it's ok.

  8. The Following 4 Users Say Thank You to Greystoke For This Useful Post:

    ciojennacgalac (16-12-2012),itojessosaspos (23-11-2012),kescotekosek (03-11-2013),lrybuywejewe (26-08-2013)

  9. #5
    Junior Member rfsforums's Avatar
    Join Date
    Sep 2010
    Posts
    20
    Thanks
    1
    Thanked 43 Times in 12 Posts

    Default

    Yes, it is working. Thanks again for your help!

  10. The Following 3 Users Say Thank You to rfsforums For This Useful Post:

    itojessosaspos (23-11-2012),kescotekosek (03-11-2013),lrybuywejewe (26-08-2013)

Posting Permissions

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