On Feb 26, 2008, at 8:55 AM, Henry Felton wrote:

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

What you're looking for to me sounds like using the UPDATE syntax in MySQL... something along the lines of:

$sql = "UPDATE tablename field1="$MySuperData1" field2="$MySuperData2" where password="$MySuperHardPassword";

Of course, this is untested check the mysql site for specifics on using update. Also... always be sure to escape your data or you are asking for trouble...

That should be enough to get you started!


Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337

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

Reply via email to