Solved

problem with php script - truncate table

Posted on 2010-08-23
2
253 Views
Last Modified: 2013-12-13
Greetings,

I have a php script that gets some data and inserts it into a mysql database.

Before it inserts the data it truncates the tables that it is going to insert into.  

that looks like this:

$query = "TRUNCATE TABLE features_tab";

$result = mysql_query($query);

Recently that part isn't working so when it runs it just adds to the database and it results in duplicates then triplicates and so on.

This coincides with moving the site to a new server.

So I am thinking about how to figure this out.  What is the best way to see what $result is in this example.

Thanks very much.

Sky
0
Comment
Question by:skykuhl
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
$query = "TRUNCATE TABLE features_tab";
$result = mysql_query($query) or die (mysql_error());

and you should know what the error is you get.
0
 

Author Comment

by:skykuhl
Comment Utility
thank you.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now