Linked Questions

12 votes
4 answers
35k views

Convert date in format MM/DD/YYYY to MySQL date [duplicate]

I have a PHP function that gets passed a date in the format MM/DD/YYYY I need to then convert this so that it can be added to a MySQL field that is of type date How would I go about doing this in PHP?...
DevWithZachary's user avatar
1 vote
3 answers
2k views

PDO escapes slashes [duplicate]

Possible Duplicate: Convert MMDDYYYY to date for PHP PHP mysql insert date format I use PDO to insert data on my database, however I have a date in the form, here is the part of the code: $name ...
fishcracker's user avatar
  • 2,569
2 votes
1 answer
1k views

php date to mysql returns 0's [duplicate]

Hello i am trying to add a date time from PHP into my MySQL database, in the database I have tried date time and time stamp and I have tried it with and without current_time set as the default option, ...
jphillip724's user avatar
0 votes
1 answer
402 views

Insert date to mysql [duplicate]

Possible Duplicate: PHP mysql insert date format I'm trying to insert a date in to my mysql datebase. The problem is that when I for example try to save 2013-01-18 it saves it like this: 000-00-00....
Johannes Flood's user avatar
0 votes
0 answers
51 views

Store a 'best before' date in SQL Database [duplicate]

I am looking to store a best before date for a food product in a MySQL database. Currently I am storing it as text from an input box. When viewing the food product on a webpage it will need to ...
Cian W's user avatar
  • 106
2769 votes
27 answers
2.2m views

How can I prevent SQL injection in PHP?

If user input is inserted without modification into an SQL query, then the application becomes vulnerable to SQL injection, like in the following example: $unsafe_variable = $_POST['user_input']; ...
1231 votes
13 answers
345k views

How does the SQL injection from the "Bobby Tables" XKCD comic work?

Just looking at: (Source: https://xkcd.com/327/) What does this SQL do: Robert'); DROP TABLE STUDENTS; -- I know both ' and -- are for comments, but doesn't the word DROP get commented as well since ...
Blankman's user avatar
  • 268k
41 votes
8 answers
217k views

How to insert TIMESTAMP into my MySQL table?

In the MySQL table I have a field called date its type is called timestamp and the default is CURRENT_TIMESTAMP. However, if I leave the field blank in MySQL I get an error. When I try to insert ...
johnbumble's user avatar
6 votes
3 answers
25k views

Date is inserting as 0000-00-00 00:00:00 in mysql

My $date output is in the foreach loop 09/25/11, 02/13/11, 09/15/10, 06/11/10, 04/13/10, 04/13/10, 04/13/10, 09/24/09, 02/19/09, 12/21/08 My mysql query(PHP) is as follows ("INSERT INTO ...
vidhyakrishnan's user avatar
10 votes
2 answers
6k views

SQL injections in ADOdb and general website security

I have done pretty much reading and still don't understand 100% how some of the SQL injections happen! I'd like to see, from those who know, concrete examples of SQL injection based on my example, so ...
Ilia Ross's user avatar
  • 13.5k
2 votes
3 answers
23k views

Jquery datepicker mysql date format

I know there are some answers in this topic but i'm fresh and can't manage to do it I have insered Jquery UI DatePicker into PHP code but when I'm sending data to MySql I get this Error: Incorrect ...
user2075811's user avatar
3 votes
5 answers
8k views

Datepicker Date format insert and 0000-00-00

I have searched on the above topic and found various answers but didn't help me out whenever I post a date on from ny web form, the result on my table is always 0000-00-00 I have been at this for 2 ...
Fola Idowu's user avatar
4 votes
4 answers
2k views

MySQL date insert error

I am trying to insert a date that is formatted like 12-Aug-2012 but when I check with database set after insert, I can only see 00-00-0000 on the date field? Here is the query I use: $query= "...
user1625518's user avatar
0 votes
2 answers
2k views

Getting blank date adding date to database (wordpress, php)

Basically I'm trying to add a date to my database (just a date, not datetime) here's what I have so far: $wpdb->insert( 'my_table', array('date-adding'=>date('Y-m-d', '1994-06-14')), ...
JamesB123's user avatar
  • 113
0 votes
1 answer
1k views

Html5 type date - need full date value in database

it is my html code <div class="required" id="join_form"> <label for="DOB">DateOfBirth:</label> <input type="date" name="date" id="date" ...
M.chaudhry's user avatar

15 30 50 per page