Solved

problem with php script - truncate table

Posted on 2010-08-23
2
259 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

627 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