View Full Version : Need a quick code snippet.
08-21-2007, 04:51 PM
I was wondering how to make it so if I dont enter a value into a form it will automaticly put zero in it. Is that what zero fill is in mysql? Sorry guys, I am still a noob trying to learn.:D
08-21-2007, 04:53 PM
default it to 0 via phpmyadmin?
08-21-2007, 04:55 PM
If it's a number use intval() or typecast it to an integer. If it's a string use something like:
$value = (!empty($_POST['var']) ? $_POST['var'] : 0);
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.