ted_chou12 Posted December 24, 2006 Share Posted December 24, 2006 [code]<?phprequire("mysqlconnection.php");mysql_query("INSERT INTO userinfo(email) VALUES('$email') ") $email == "";or die(mysql_error());?>[/code]what I wish to do is set email to blank after the scipt has write into the database, but this doesnt seem to work, by the way, I also wish to have two messages, one is entry successful, and the other is entry failed. But I dont know how to add it in.. :'(THanksTed Link to comment https://forums.phpfreaks.com/topic/31772-can-anyone-help-me-with-this/ Share on other sites More sharing options...
steelmanronald06 Posted December 24, 2006 Share Posted December 24, 2006 First make sure that field is allowed to be NULL in your database. then do:[code]<?phprequire("mysqlconnection.php");$email = NULL;mysql_query("INSERT INTO userinfo (email) VALUES('$email') ")or die(mysql_error());?>[/code]That is assuming that this query is setting the email to empty. If so, the Nulled variable has to be BEFORE the query is executed...PHP is liner. It executes from top to bottom, left to right. Link to comment https://forums.phpfreaks.com/topic/31772-can-anyone-help-me-with-this/#findComment-147349 Share on other sites More sharing options...
ted_chou12 Posted December 24, 2006 Author Share Posted December 24, 2006 thanks, but what does null do with the variable? Link to comment https://forums.phpfreaks.com/topic/31772-can-anyone-help-me-with-this/#findComment-147351 Share on other sites More sharing options...
.josh Posted December 24, 2006 Share Posted December 24, 2006 [code]<?phprequire("mysqlconnection.php");if (mysql_query("INSERT INTO userinfo(email) VALUES('$email')")) { echo "success"; unset ($email);} else { echo "fail";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/31772-can-anyone-help-me-with-this/#findComment-147354 Share on other sites More sharing options...
steelmanronald06 Posted December 24, 2006 Share Posted December 24, 2006 My first reaction to this would be RTFM! But, I can see that you are clearly, truly, confused...in which case, your giving bad advertisement to your signature because your posts reflect that site. Anyways, Null means NULL! Let me get you a def. of null from the dictionary: Null is usually that which has no value (nothingness) or no effect. It originates from the Latin word nullus, meaning not any.so when you set a variable to NULL, it means you set it to be EMPTY! With NOTHING in it! NOTHING EXISTS IN IT! It has no effect except to exist!now i can say it, "RTFM": http://us2.php.net/null Link to comment https://forums.phpfreaks.com/topic/31772-can-anyone-help-me-with-this/#findComment-147355 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.