My database have a profile table with image column. I want to set the default image using default value if the user are not inserting his image URL in the web form.
The column definition:
profile_image varchar(255) NOT NULL DEFAULT 'http://i.imgur.com/U.png'
I already inserted the default image URL in phpmyadmin but everytime I click submit at web form, every key in data at webform is stored in the profile table but the image column is empty.
I know I can do this with form by adding the image URL in web form but I want to do this via mysql.
This problem is solved because I insert the image at php insert but how do I use the null value to let mysql know I'm sending NULL? Is this the correct way of using Null?
$nl = NULL;
$query = "INSERT INTO `student` (
`name` ,
`emel` ,
`address` ,
`profile_image`
)
VALUES (
'$name', '$emel', '$add', '$nl');";
The above code won't work. The profile_image column is still empty.