Re: change info in database not successful

From: Date: Wed, 29 Aug 2001 19:07:22 +0000
Subject: Re: change info in database not successful
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-65087@lists.php.net to get a copy of this message
maybe somebody else will be able to come up with a much more graceful solution to this, but i think you need to forget unset()-- all it does is destroy a var within a script. your db data doesn't become a var until you fetch it, but unset() isn't a mysql function and doesn't interact with the db at all. your example code is a little hard to read, but is there a reason why you can't just... $query = "UPDATE tablename set password='$n_password' WHERE id = '$id'"; --- sgibbs@vt.globalhealth.org wrote: > Good day everyone, > > I'm writing because the username/password database > table we had written for > us does not seem to be accepting changes to a > password. When I make a > change, not only does the new password not take > effect but it disables the > entire account making it useless) > > Below is the code from the change.php3 file. I > think the problem is > possibly being caused with the unset() function but > I'm not sure.... > > Any ideas? > > Thanks again for your help. Shawna > > > <? php3 > > if($n_password1 != $n_password2){ print "passwords > do not match. try again."; exit; > };$password1=$n_password1;$username = > addslashes($n_username);$name_prefix = > addslashes($name_prefix);$name_first = > addslashes($name_first);$name_middle = > addslashes($name_middle);$name_last = > addslashes($name_last);$name_suffix = > addslashes($name_suffix);$email = > addslashes($email);$designation = > addslashes($designation);$title = > addslashes($title);$company = > addslashes($company);if($newsletter != "y"){ > $newsletter = "n"; }; > (....not sure what is going on here.... )if($id){ > unset($password); if($password1){ $password = ", > password = password('$password1')"; }; > > mysql_db_query("$db", "update members set username > = '$username', > name_prefix = '$name_prefix', name_first = > '$name_first', name_middle = > '$name_middle', name_last = '$name_last', > name_suffix = '$name_suffix', > email = '$email', designation = '$designation', > title = '$title', > foodchain='$foodchain', company = '$company', > newsletter = '$newsletter' > $password where id = $id") || print > "FAILED.\n\n";}else{ mysql_db_query("$db", "insert > into members (id, username, password, > foodchain, name_prefix, name_first, name_middle, > name_last, name_suffix, > email, designation, title, company, newsletter) > values(null, '$username', > password('$password1'), $foodchain, '$name_prefix', > '$name_first', > '$name_middle', '$name_last', '$name_suffix', > '$email', '$designation', > '$title', '$company', '$newsletter')"); };?> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > php-general-unsubscribe@lists.php.net > For additional commands, e-mail: > php-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > __________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com

« previous php.general (#65087) next »