Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

php question


julia

Recommended Posts

Hey there.

Is it possible to make more than one query from 2 different tables on the same page

For instance

 

$account_query = tep_db_query("select customers_gender, customers_firstname, customers_lastname, customers_dob, customers_email_address, customers_telephone, customers_nightphone from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");

$account = tep_db_fetch_array($account_query);

 

then repeat to get values from the Address Book Table

 

When I put the two strings on the page, I get a SQL syntax error.

 

Thanks

Link to comment
Share on other sites

Give this a try:

$account_query = tep_db_query("select c.customers_id, c.customers_gender, ab.customers_id, ab.entry_gender_  from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab where c.customers_id = ab.customers_id and c.customers_id = '" . (int)$customer_id . "'");

I'm doing it from memory so it may need some tweaking and you will need to fill in all of the fields you want to call. but it should work.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Give this a try:
$account_query = tep_db_query("select c.customers_id, c.customers_gender, ab.customers_id, ab.entry_gender_ ?from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab where c.customers_id = ab.customers_id and c.customers_id = '" . (int)$customer_id . "'");

I'm doing it from memory so it may need some tweaking and you will need to fill in all of the fields you want to call. but it should work.

 

Jack

 

Thanks Jack!

I will try that.

Julie

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...