morbidxangel Posted December 9, 2005 Posted December 9, 2005 hello there. i need some help with my code. i added a field called customers_ref_id in the customers table. it seems that it cannot execute the query successfuly. how can i add a data in the new field? checkout_process.php: if ($customer_ref_refred!=""){ tep_db_query("update customers set customers_ref_id = ".$customer_ref_refred.""); } i am having this error output: 1054 - Unknown column 'teststringforref' in 'field list' update customers set customers_ref_id = teststringforref [TEP STOP]
markmca Posted December 9, 2005 Posted December 9, 2005 The problem with your code is that you are sending a string to teh sql query to be inserted into the database so it should be enclosed within single quotes as follows tep_db_query("update customers set customers_ref_id = '".$customer_ref_refred."'"); This should work and onw more thing is ur updating the customers table with the custemers_ref_id .. are you sure you want to update all the customers or a particular list of customers.. just a doubt as you have not specified a where clause in the query Good Day KP hello there. i need some help with my code. i added a field called customers_ref_id in the customers table. it seems that it cannot execute the query successfuly. how can i add a data in the new field? checkout_process.php: if ($customer_ref_refred!=""){ tep_db_query("update customers set customers_ref_id = ".$customer_ref_refred.""); } i am having this error output: 1054 - Unknown column 'teststringforref' in 'field list' update customers set customers_ref_id = teststringforref [TEP STOP] :thumbsup: :thumbsup:
morbidxangel Posted December 9, 2005 Author Posted December 9, 2005 The problem with your code is that you are sending a string to teh sql query to be inserted into the database so it should be enclosed within single quotes as follows tep_db_query("update customers set customers_ref_id = '".$customer_ref_refred."'"); This should work and onw more thing is ur updating the customers table with the custemers_ref_id .. are you sure you want to update all the customers or a particular list of customers.. just a doubt as you have not specified a where clause in the query Good Day KP :thumbsup: :thumbsup: thank you very much KP. i should add a -->where customers_id='".$customer_id."' its working fine now. God Bless!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.