geo0428 Posted November 16, 2004 Posted November 16, 2004 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]
geo0428 Posted November 17, 2004 Author Posted November 17, 2004 Help!! Database error problemI 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] <{POST_SNAPBACK}> 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');
geo0428 Posted November 17, 2004 Author Posted November 17, 2004 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'); <{POST_SNAPBACK}> 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);
Guest Posted November 18, 2004 Posted November 18, 2004 Why not just create a database class to get a layer of abstraction??
Recommended Posts
Archived
This topic is now archived and is closed to further replies.