Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to Empty contents of a table using tep_db_query


Rumble

Recommended Posts

Hi All,

 

Right i need a tep_db_query line that will delete or empty the contents of a table in my database called TABLE_ORDERS_COUNTER

 

I know how to insert a single line/row eg

 

tep_db_query("insert into " . TABLE_ORDERS_COUNTER . " etc etc

 

but how do you empty the table with one line of code? (I dont want to delete the table just empty it)

 

Thanks in advance!! :D

Reddy to Rumble

 

Thank you osCommerce and all who Contribute to her!

Link to comment
Share on other sites

tep_db_query("TRUNCATE TABLE" . TABLE_ORDERS_COUNTER . " etc etc

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Hi Wizard!!!

 

Thanks for that

 

it worked for me but i had to use

 

tep_db_query("truncate table orders_counter");

 

and not

 

tep_db_query("truncate table " . TABLE_ORDERS_COUNTER);

 

im not sure why but anyway thanks for the lead in the right direction!

Reddy to Rumble

 

Thank you osCommerce and all who Contribute to her!

Link to comment
Share on other sites

Well, I had assumed that TABLE_ORDERS_COUNTER was a veriable that you had defined in something that you were working on.

 

In the one that worked, though, you're just calling the table directly.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...