Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

I need some help with splitPageResults()


Guest

Recommended Posts

Posted

If you are using mutiple database and have a different resource link_identifier and you call splitPageResults() it will not work. splitPageResults() doesn't accept an argument for the new link_identifier. It calls tep_db_query() and tep_db_input() with the default link_identifier. For example:

 

I call splitPageResults() like splitPageResults($history_query_raw, MAX_DISPLAY_ORDER_HISTORY,links_aff_products_id,'page');

 

 

it eventually calls

tep_db_query("select count(" . $count_string . ") as total " . substr($this->sql_query, $pos_from, ($pos_to - $pos_from)));

 

and tep_db_input($count_key); using the default link_identifier.

 

 

Because splitPageResults() doesn't take any arguments for the link_identifier I can't send tep_db_query() and tep_db_input() any new link_identifier.

 

 

Is it supposed to work this way or is this a bug?

Posted
I don't know that any of the classes allow for a passed in resource identifier. This would be something you need to write yourself.

 

 

That make sense because oscommerce was written to only use one database. Now I get to destroy my shop, hehe. Thanks for the reply.

Posted

In what circumstances would you need to use different connections? If you're only using one connection per page, based on the page, then you can create a rule for defining connection information based on which page is being run.

 

So in includes/configure.php, you'd have something like

 

if( $page == 'advanced_search' || $page == 'product_info' ) {

define( 'DB_DATABASE', 'database1' );

} else {

define( 'DB_DATABASE', 'database2' );

}

Contributions

 

Discount Coupon Codes

Donations

Archived

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

×
×
  • Create New...