mySQL插入

I have the following code where:

Client and Project are varchar, Date is a Date and Quantity is an interger. I am wanting to insert them into a new table called Billings.

When I run the code, the date cames back with 0/0/0000, Client is CLient, Project is Project.

It appears I am not understanding the ' or " or . but I can not find any good examples on the web that will help me determine the correct code. Any help with the correct code is appreciated. Thanks in advance.

The code is:

$strSQLInsert = "insert into Billings (Client, Project, Date, Quantity) values ('Client', 'Project', Date, Quantity)";

Thanks

You are not sending the values, instead you are sending the strings 'Client', 'Project' etc.

You have to use

INSERT INTO Billings (Client, Project, Date, Quantity)
values( client_value, project_value, date_value, quantity_value)

So while building the query string use the variables that hold the values -

$strSQLInsert = "insert into Billings (Client, Project, Date, Quantity) values ('$Client','$Project','$Date',$Quantity);"

Change query like this

INSERT INTO Billings (Client, Project, Date, Quantity)
values('$client_value','$project_value',$date_value,$quantity_value);

and don't forget to set all this variable $client_value,$project_value etc...

Hi First Declare the date in a variable either manually or automatically(will take current date) by php date function

ex. $date = '2013-08-09' or $date = date("Y-m-d"); and then insert this $date variable into your insert query.