Display deleted records in mysql

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Rmias
Forum Newbie
Posts: 24
Joined: Wed Nov 26, 2003 11:02 am

Display deleted records in mysql

Post by Rmias »

Hi,

If I deleted records from Mysql table, is there a way to display the deleted records using php. I know that the delete command will not permanently remove the records

Thanks

Rmias
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

I know that the delete command will not permanently remove the records
I'd be interested to find out how you know this, i was under the impression that a deleted row is premanently deleted from the table. Please correct me if i'm wrong ;)
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

well i deleted a whole database before by accident and i couldnt retrieve it no matter how i tried, there is no syntax for this task is there?

i know this code can view what you have just deleted but i dont think this is what you mean

Code: Select all

<?php
mysql_connect('host', 'user', 'pass') or die (mysql_error());
mysql_select_db('mydb') or die (mysql_error());

mysql_query('DELETE FROM mytable WHERE ref < 150');
printf("Number of Items Deleted = %d\n", mysql_affected_rows());

?>
Last edited by malcolmboston on Fri Apr 16, 2004 7:00 am, edited 1 time in total.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Quote from manual "Once you delete data from a table, it's gone for good!"

Mark
Post Reply