Jump to content

can anyone help me with this...


ted_chou12

Recommended Posts

[code]
<?php
require("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.. :'(
THanks
Ted
Link to comment
https://forums.phpfreaks.com/topic/31772-can-anyone-help-me-with-this/
Share on other sites

First make sure that field is allowed to be NULL in your database. then do:

[code]
<?php
require("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. 
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.