Learn how to empty or truncate MySQL database tables through script, or manually using the PHPMyAdmin. Sets indexes back to zero as well. I am using …
Original source
Learn how to empty or truncate MySQL database tables through script, or manually using the PHPMyAdmin. Sets indexes back to zero as well. I am using …
Original source
5 responses to “How to Empty or Truncate Your MySQL Database Table Tutorial”
<?php
include_once"connect_to_mysql.php";
$sql=mysql_query("TRUNCATE TABLE table_name");
if($sql){
print"Table has been emptied and indexes set back to zero";
}
?><?php
include_once"connect_to_mysql.php";
$sql=mysql_query("TRUNCATE TABLE table_name");
if($sql){
print"Table has been emptied and indexes set back to zero";
}
?>
is there a way to do that every day at 6pm? Automatic?
Help. I'm using phpmyadmin. I have the tables all set up. problem – using visual basic i export the database information I want to change/add to the existing tables. There is 6 of them and all works fine. using *.csv file. when I first imported/created the database it has oh 50 tables and all the data was install correct. What I need to do in a text file that I would import is to truncate the tables only 6 table. leaving the structure of the tables and then import the data into the right tables and do it with one file. Can it be done. Thanks looking forward to hearing from anyone. what am I doing wrong below.
TRUNCATE TABLE oc_product_description;
TRUNCATE TABLE oc_product_reward;
TRUNCATE TABLE oc_product_to_category;
INSERT INTO `oc_product_description` (`product_id`, `language_id`, `name`, `description`, `tag`, `meta_title`, `meta_description`, `meta_keyword`) VALUES
(1, 1, 'Large Monticello Candle Lantern', 'The stately design of this candle lantern will dress up your home indoors or out. Use the front latch to open the door and insert the candle of your choice. The clear glass panels and the antiqued frame are the perfect accent to beautiful candlelight and the lantern can rest on its base or be hung from the top loop. Candle not included. 20 1/4 high with loop at top. ', '', 'Large Monticello Candle Lantern', 'lanterns', 'lanterns'),
(2, 1, 'Large Wire Vase Candleholder', 'This large wire vase turns candlelight into modern glow! Insert a candle of your choice inside the glass cup and light it to create contemporary shine in your room. glass holder: 4 x 4 x 13 high. ', '', 'Large Wire Vase Candleholder', 'candles', 'candles'),
(3, 1, 'Antiqued Iron 5-Candle Stand', 'Set the night aglow with help from this romantically rustic candelabra. Five candle seats are perched on top of scrolling wrought iron flourishes finished with antiqued paint to look like an old-world treasure. Place it on your mantel or tabletop and light the candles of your choice for spectacular shine! ', '', 'Antiqued Iron 5-Candle Stand', 'candles', 'candles'),
INSERT INTO `oc_product_reward` (`product_reward_id`, `product_id`, `customer_group_id`, `points`) VALUES
(1, 0, 1, 2),
(2, 0, 1, 2),
(3, 0, 1, 2),
INSERT INTO `oc_product_to_category` (`product_id`, `category_id`) VALUES
(1, 88),
(2, 85),
(3, 85),
Thanks Adam! Great tutorial! 🙂
hahaha I am not in those 100, but I just wanted to thank you for visiting my channel! Your Flash videos are great!