Forum Moderators: coopster

Message Too Old, No Replies

deleting records from mysql

describes problem

         

andylarks

11:35 am on Nov 13, 2003 (gmt 0)

10+ Year Member



I have a php form page that updates several mysql tables. The updates may contain less, the same, or more records than already exist in each of the tables. Inasmuch, I figured the easiest thing to do would be to delete all the existing records in each table, and replace them with the updated records just received.

My problem is that the delete queries, whilst they say they have run successfully, aren't actually doing anything, and so I end up with multiple entries.

The delete statement is:

DELETE FROM join_proj_staff WHERE ID=$id;

This works fine directly in mysql, and so I am assuming it's something to do with php not having permission to delete records, but I have no idea where this would be set.

So, firstly, can anyone suggest a better way of updating the details, and secondly, can anyone tell me why my delete statement isn't actually working.

Thanks all :)

Andy

Birdman

1:21 pm on Nov 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would try printing the sql statement to the screen to see if the $id variable is there. That's the only thing I see that could cause the it to fail.

andylarks

1:35 pm on Nov 13, 2003 (gmt 0)

10+ Year Member



I did that already, and it says:

successfully deleted join_proj_staff - DELETE FROM join_proj_staff WHERE ID=175;
successfully deleted join_proj_staff - DELETE FROM join_proj_staff WHERE ID=176;

which is why I'm thinking it might be some kind of permissions issue with php/mysql and deleting records.

Thanks for responding tho :)