Jump to content

deleteing from database


astralaaron
 Share

Recommended Posts

my administrative panel for the site I am working on is almost complete..i have a news section that can be added to, updated, or deleted (with the id#)I also have a schedule page for their web tv, that they can add schedule to..i have it so you can update / delete by an (id) individually..i have a field on this schedule table that is a date field. its not an automatic dateits a varchar field where they can write say 12/12/12for the date.. for 1 I am not sure if its good to have /'s in there like that. they could also write it as 12-12-12 or whatever if thats better..anyway the problem is, I also want them to be able to delete all entries with the date 12/12/12or whatever date... i tried putting 12/12/12 in the text field and hit delete and it does nothing.. but if i just put 12 alone in then it deletes it..this is a problem! i need it to be the exact date 12/12/12..anyone know how i can do this?hopefully my question makes sence!

Link to comment
Share on other sites

one way is to validate the date input using regular expressions and not to allow dates with other characters than '/'it would be easier to perform queries this wayanother way is to create 3 different input fields for month, day and year; than just concatenate them and perform any querye.g. $date = $month.'/'.$day.'/'.$year;

Link to comment
Share on other sites

one way is to validate the date input using regular expressions and not to allow dates with other characters than '/'it would be easier to perform queries this wayanother way is to create 3 different input fields for month, day and year; than just concatenate them and perform any querye.g. $date = $month.'/'.$day.'/'.$year;
thanks for the input it makes sence what you are saying, I kinda just want the 1 field though I have enough!
Link to comment
Share on other sites

I thought to create 3 input fields on the web page where the users enter the date and insert them on one field on table. Because this way the user enters the only day, month and year. Then when inserting in database you concatenate this way$date = $month.'/'.$day.'/'.$year;and you will know that the separation character in date would always be '/'

Link to comment
Share on other sites

I thought to create 3 input fields on the web page where the users enter the date and insert them on one field on table. Because this way the user enters the only day, month and year. Then when inserting in database you concatenate this way$date = $month.'/'.$day.'/'.$year;and you will know that the separation character in date would always be '/'
yeah I might do it this way, but i think the way I am doing it now is working okay so I am not sure
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...