Solved

problem with php script - truncate table

Posted on 2010-08-23
2
257 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:Schuyler Kuhl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 33500543
$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:Schuyler Kuhl
ID: 33500616
thank you.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

734 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