PDA

View Full Version : user name with hyphen causing error



rfsforums
26-03-2011, 16:10
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

Greystoke
26-03-2011, 17:30
Hi,

Sorry about this.

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

Find around line 525:


$check_customer_query = tep_db_query("select customers_firstname, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_id = '". $usersid ."'");


Add before it:


$customers_gender = 'm';
$customers_default_address_id = '0';
$customers_newsletter = '1';


Find around line 528:


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:




$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:



tep_db_query("update " . TABLE_CUSTOMERS . " set customers_username = '" . $vbusername . "' where customers_id = '" . $usersid . "'");


Replace with:



$sql_data_array = array('customers_username' => $vbusername);

tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . $usersid . "'");

rfsforums
30-03-2011, 15:13
Thanks for getting back so quickly.

I made the changes but when I uploaded the file I got this error message:

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

Greystoke
30-03-2011, 15:46
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.

rfsforums
30-03-2011, 18:30
Yes, it is working. Thanks again for your help!