joining tables and getting results in php query
| From: | Publications | Date: | Mon, 02 Apr 2001 18:26:16 +0000 |
| Subject: | joining tables and getting results in php query | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-46660@lists.php.net to get a copy of this message | ||
I would like to be able to type in the username, select a change option and
then update a table that does not contain the username.
auth_user - contains user_id and username
userinfo - contains user_id and the field I want to update
What do I need to do fix this code?
if ($userinfo) {
if ($submit=='Unsubscribe') {
$mail_list='N';
} else {
$mail_list='B';
}
$res=mysql_result("select user_id from auth_user where
username='$username'"); //how do I get this to relate to my next query?
$res=mysql_query("replace into userinfo values
('$user_id','$mail_list')",$dbe);
if ($res) {
print "Email: $username ($mail_list)<br>\n";
} else {
print "Problems adding email to unsubscribe list: ";
print mysql_error()."<br>\n";
}
}
print "<form action=\"dontEmail.php\" method=get>\n";
$sess->hidden_session();
print "Email Address: ";
print "<input type=text size=30 maxlength=100 name=\"username\">\n";
print "<input type=submit name=\"submit\" value=\"Bad Email
Address\">
\n";
print "<input type=submit name=\"submit\"
value=\"Unsubscribe\"><br>\n";
print "</form>\n";
Thank you
Duffy Betterton
Director of Publications
publications@mtadistributors.com