Jump to content

SQL error


BigD

Recommended Posts

In the following code why gdate has the value of 12-08-13? could that cause sql error? or could the picture field(which is a thumb nail picture) cause the error?I have used the date("y-m-d") before and I was getting 2012-08-12. $gdate = date("y-m-d"); echo "gdate is $gdate"; $query = "INSERT INTO graduate(fname, lname, phone, email, picture, startdate, ". "gdate, gender, stdid, classid, intid) values('$fname', '$lname', '$phone', '$email', ". "'$picture', '$startdate', '$gdate', '$gender', '$stdid', '$classid', '$intid')"; echo "insert grad SQL is $query"; $result = mysql_query($query); if ($result) { echo "<h2>Student $fname $lname graduated</h2>\n"; } else { echo "<h2>SQL error</h2>\n". mysql_error(); }

Link to comment
Share on other sites

This is the result: gdate is 12-08-13insert grad SQL is INSERT INTO graduate(fname, lname, phone, email, picture, startdate, gdate, gender, stdid, classid, intid) values('F', 'L', '111-222-3333', 'lf@gmail.com', 'JFIF>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality C    $.' ",#(7),01444'9=82<.342C 2!!22222222222222222222222222222222222222222222222222

Link to comment
Share on other sites

sql error will tell where the error is. if gdate is date type the format is YYYY-MM-DD. if picture column is location of thumbnail it should be char/varchar or other textutal type. if it is the image itself it has to be stored as binary type

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
×
×
  • Create New...