Lemme see if I get this right:

You could just do this:

UPDATE userPW SET field1=$satinized_post_field1,
field2=$sanitized_post_field2 WHERE userid=$userId and password=$userPw


if (mysql_affected_rows($conn) > 0){
        echo "updated"
}else{
        echo "error: ".mysql_error($conn);
}

http://docs.php.net/manual/function.mysql-query.php

I suppose you have a relationship between pw and user (as stated in
userid=$userid).


Hope this helps!

-----Mensagem original-----
De: Henry Felton [mailto:[EMAIL PROTECTED] 
Enviada em: terça-feira, 26 de fevereiro de 2008 10:55
Para: php-db@lists.php.net
Assunto: [PHP-DB] PHP, MySQL and Lookups

Hi everyone,

I'm just getting into PHP at the moment and was wondering; what code would I
need to look at a field value entered in a form, then if that value is found
in my table, enter all the other information entered in the form, to the
other fields on that record.
Basically, what I'm trying to do is give a load of users an individual
password that they enter, with various other pieces of information such as
year of birth, single/married or whatever, into a form. In MySQL I have a
table with three fields, but only the password one has any data in them. A
script will then took in the table to find the password entered in the form,
and then append all the other information (i.e. data for the other two
fields) to the particular record that holds the password value entered.

Hope that made sense, but I'd be so grateful if someone could help me with
this....

Thanks,
Max

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to