
August 21st, 2004, 06:50 PM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 18
Time spent in forums: 42 m 10 sec
Reputation Power: 0
|
|
|
Replacing an empty string with NULL
I have an form where someone can choose to upload a photo. If the person does not upload a photo, an emtpy string is inserted in the DB. How can I have it insert a NULL value instead of an empty string when they choose NOT to upload a photo but complete the form anyway?
Here is my query:
$query = "INSERT INTO routes(user_id , date_climbed , route , pitchs , rating, area, outcrop, type, style, private_comments, public_comments, stars, route_photo) VALUES('NULL', '$_POST[date_climbed]', '$_POST[route]', '$_POST[pitchs]', '$_POST[rating]', '$_POST[area]', '$_POST[outcrop]', '$_POST[type]', '$_POST[style]', '$_POST[private_comments]', '$_POST[public_comments]', '$_POST[stars]', '$_POST[$route_photo]')";
Much Thanks -- CH
|