Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help!! Database error problem


geo0428

Recommended Posts

Help!! Database error problem

I am trying to use the database functions to connect to another database. I think that I have the tep_connect correct because I can see that I created a second resource. I?m using the tep_db_perform() to insert an array into a new table. Here are the connect statements

 

tep_db_connect() or die('Unable to connect to database server!');

tep_db_connect(DB_SERVER,DB_SERVER_OLM_USERNAME,DB_SERVER_OLM_PASSWORD,DB_OLM_DA

TABASE,'db_olm_link') or die('Unable to connect to database server!');

 

$db_link is Resource # 7

$db_olm_link is Resource #8

So, I have created two resources.

 

 

Here is the override satatment for tep_db_perform

tep_db_perform(TABLE_CUSTOMER, $sql_data_array,'insert','db_olm_link');

 

Here is the error statement. I am not sure how to interpret it:

 

0 -

 

insert into TABLE_CUSTOMER (iolmid, icustid, isiteid, chfirstname, chlastname, vchemail, vch_password) values ('1', '21', '1', 'George', 'Hemminger', '[email protected]', 'caef349118700b7c65029853e171efe2:44')

 

[TEP STOP]

Link to comment
Share on other sites

Help!! Database error problem

I am trying to use the database functions to connect to another database.? I think that I have the tep_connect correct because I can see that I created a second resource.? I?m using the tep_db_perform() to insert an array into a new table.? Here are the connect statements

 

tep_db_connect() or die('Unable to connect to database server!');

? tep_db_connect(DB_SERVER,DB_SERVER_OLM_USERNAME,DB_SERVER_OLM_PASSWORD,DB_OLM_DA

TABASE,'db_olm_link') or die('Unable to connect to database server!');

 

$db_link is Resource # 7

$db_olm_link is Resource #8

So, I have created two resources.

Here is the override satatment for tep_db_perform

tep_db_perform(TABLE_CUSTOMER, $sql_data_array,'insert','db_olm_link');

 

Here is the error statement.? I am not sure how to interpret it:

 

0 -

 

insert into TABLE_CUSTOMER (iolmid, icustid, isiteid, chfirstname, chlastname, vchemail, vch_password) values ('1', '21', '1', 'George', 'Hemminger', '[email protected]', 'caef349118700b7c65029853e171efe2:44')

 

[TEP STOP]

 

 

You linked to the wrong database.

 

tep_db_perform is missing a parameter so you didn't override the link.

 

Here are the input parameters.

function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {

 

Here are the overrides

tep_db_perform(TABLE_CUSTOMER, $sql_data_array,'insert','','db_olm_link');

Link to comment
Share on other sites

You linked to the wrong database.

 

tep_db_perform is missing a parameter so you didn't override the link.

 

Here are the input parameters.

function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {

 

Here are the overrides

tep_db_perform(TABLE_CUSTOMER, $sql_data_array,'insert','','db_olm_link');

 

 

Warning - many of the tep_db functions don't include the default link and the link override

example

function tep_db_insert_id() {

return mysql_insert_id();

}

will not work when 2 links are defined. The link must be specified. The sql must be:

mysql_insert_id(link);

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...