Jump to content

[SOLVED] Table Insert & Date:Time


shlomikalfa

Recommended Posts

it's been all night i'm up and trying to make these work but HOW ?!?!

Please Help!!!

___________

 

 

how do i make MySQL add the current date:time on new table insertion ?!

- want to know if there is such an option that makes the MySQL db add the date:time data to a table collumn on it's own.

- also, how do i make MySQL auto-increment a collumn var whenever it's being read ?!

 

 

 

____________

Please Help!!!

THANKS ALOT IN ADVANCE !!!

Link to comment
Share on other sites

i already got a table but i want to have in my table the following 2 fields:

-> field "date", i want that field to be automatically filled with the date/time of the MySQL DB as the new entry is created.

-> field "Counter", i want that field to be automatically filled to hold the number of times it was found by MySQL quaries.

 

i thinks that's better...

please help me  ???

Link to comment
Share on other sites

i am not sure about ur q's, but why not use php to update date:

$date=CURDATE();

 

and then put the $date variable in the insert or update query.When the script run it will automatically update the field date without input by user.

 

for counter  field just try it like this:

counter=counter+1;

in ur query, every time the script run it will update the field counter with one increment.

 

Hope this will help.

Link to comment
Share on other sites

to use that:

counter=counter+1;

 

i have to request the count from the mysql table first and then add counter to it right ?!

(and same with date...)

 

- i was asking if there is a way to do it without retrieving the var and then inserting a new one after it's been processed...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.