Current location: Hot Scripts Forums » Programming Languages » PHP » Generating a very basic log file of data insert


Generating a very basic log file of data insert

Reply
  #1 (permalink)  
Old 05-10-10, 05:23 AM
macintosh macintosh is offline
Newbie Coder
 
Join Date: Mar 2007
Posts: 84
Thanks: 1
Thanked 0 Times in 0 Posts
Generating a very basic log file of data insert

I have a few tables where few users insert the data. For example:

User a inserts an entry in table 1.
User b inserts an entry in table 2.
User c inserts an entry in table 2.

Now I want to create a log file to display the above activities of all users. How I can do a simple log of this?
I just want to have a simple log file to display the above activities as:

User a inserted an entry in table 1.
...
..

Any ideas/especially a basic code example will be highly appreciated.
Reply With Quote
  #2 (permalink)  
Old 05-10-10, 07:41 AM
Silvor Silvor is offline
New Member
 
Join Date: May 2010
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
PHP Code:

$LogFile "filename_on_server.txt";
$fh fopen($LogFile'w') or die("Can't Open File");
$stringData "User a inserted an entry into table 1\n";
fwrite($fh$stringData);
fclose($fh); 
Reply With Quote
  #3 (permalink)  
Old 05-10-10, 08:32 AM
macintosh macintosh is offline
Newbie Coder
 
Join Date: Mar 2007
Posts: 84
Thanks: 1
Thanked 0 Times in 0 Posts
Sorry if my question was not clear, I meant to ask if a user inserts some data in mysql database, then i want to log that action)

For example, User A inserts data

Quote:
mysql_query("INSERT INTO User (FirstName, LastName)
VALUES ('Peter', 'Griffin')");
Another user inserts some data in other table.
Quote:
mysql_query("INSERT INTO Phone(Name)
VALUES ('123')");
After the user has inserted the data successfully; I want to log the above activity, such as
A User inserted his Name.
A user inserted his phone number.

I'd appriciate any help.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Submit button data written to a .txt file ziul Everything Java 0 08-08-07 03:41 PM
More info SLAYER18 Job Offers & Assistance 1 01-17-05 05:06 AM
Upload file to table so ONLY files tied to primary key are displayed in record? grafixDummy PHP 4 12-20-03 04:28 PM
Upload file type and size limiter! Arctic ASP 1 08-02-03 07:06 PM


All times are GMT -5. The time now is 08:14 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.