alohatofu Posted April 28, 2007 Share Posted April 28, 2007 Hello, I have a problem. My table will display any number in the database except when it's zero. It will be blank and not displaying anything. I have changed to VARCHAR, VAR, INT, SMALLINT.. etc.. still would not show up. can anyone help? Thanks Link to comment https://forums.phpfreaks.com/topic/49051-displaying-zero-in-field/ Share on other sites More sharing options...
heckenschutze Posted April 28, 2007 Share Posted April 28, 2007 Hmm Link to comment https://forums.phpfreaks.com/topic/49051-displaying-zero-in-field/#findComment-240333 Share on other sites More sharing options...
heckenschutze Posted April 28, 2007 Share Posted April 28, 2007 How are you displaying it...? 0 = empty, so there's no need to waste 1 byte usually storing 0... Link to comment https://forums.phpfreaks.com/topic/49051-displaying-zero-in-field/#findComment-240334 Share on other sites More sharing options...
arianhojat Posted April 28, 2007 Share Posted April 28, 2007 so u probably getting the value via ... $someValue = $row['theField']; ... echo $someValue; //or echo htmlspecialchars($someValue); i dunno why 0 would output as anything else unless u r doing something funky to the number echoing it Link to comment https://forums.phpfreaks.com/topic/49051-displaying-zero-in-field/#findComment-240335 Share on other sites More sharing options...
heckenschutze Posted April 28, 2007 Share Posted April 28, 2007 Remember 0 == NULL, Me thinks you want: printf("%01d", $someValue); Assuming printf is anything like printf in C... Link to comment https://forums.phpfreaks.com/topic/49051-displaying-zero-in-field/#findComment-240338 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.