...

View Full Version : Need a quick code snippet.



emuse
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

rafiki
08-21-2007, 04:53 PM
default it to 0 via phpmyadmin?

Inigoesdr
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);
or if/else.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum