Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

DB query oddness in account_edit.php


Guest

Recommended Posts

Posted

I am working on a heavily modified osC installation, so this problem may relate to something I've changed/broken without realising it, but basically with the account_edit.php page it only returns the First Name and Last Name, it doesn't return any other fields.

 

However, if I put the results of each field in the array into defined variables, they can be displayed fine so the problem doesn't appear to be in the query itself?

 

Here are some lines of code:

 

Query

$account_query = tep_db_query('SELECT customers_gender, customers_firstname, customers_lastname, customers_dob, customers_email_address, customers_telephone, customers_fax FROM ' . TABLE_CUSTOMERS . ' WHERE customers_id = "' . (int)$customer_id . '"');

$account = tep_db_fetch_array($account_query);

 

Echo Code (Items Not In Defined Variables):

echo 'gender: ' . $account['customers_gender'] . '<br />';
echo 'firstname: ' . $account['customers_firstname'] . '<br />';
echo 'lastname: ' . $account['customers_lastname'] . '<br />';
echo 'dob: ' . tep_date_short($account['customers_dob']) . '<br />';
echo 'email: ' . $account['customers_email_address'] . '<br />';
echo 'tel: ' . $account['customers_telephone'] . '<br />';
echo 'fax: ' . $account['customers_fax'] . '<br />';

 

Returns:

gender:
firstname: First Name
lastname: Last Name
dob:
email:
tel:
fax:

 

Echo Code (In Defined Variables)

$q_customers_gender = $account['customers_gender'];
$q_customers_firstname = $account['customers_firstname'];
$q_customers_lastname = $account['customers_lastname'];
$q_customers_dob = tep_date_short($account['customers_dob']);
$q_customers_email = $account['customers_email_address'];
$q_customers_tel = $account['customers_telephone'];
$q_customers_fax = $account['customers_fax'];

echo 'gender: ' . $q_customers_gender . '<br />';
echo 'firstname: ' . $q_customers_firstname . '<br />';
echo 'lastname: ' . $q_customers_lastname . '<br />';
echo 'dob: ' . $q_customers_dob . '<br />';
echo 'email: ' . $q_customers_email . '<br />';
echo 'tel: ' . $q_customers_tel . '<br />';
echo 'fax: ' . $q_customers_fax . '<br />';

 

Returns:

gender: m
firstname: First Name
lastname: Last Name
dob: 01/01/1950
email: [email protected]
tel: 01234 567890
fax: 01234 098765

 

Obviously it isn't a huge issue for now as I can use my own defined variables, but why can't I use the $account[] array variables? Am I missing something here?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...