Search Webmaster Help and Solution

Is there an alternative code to this?

Hi

I have a form with 6 textfields that will be used to edit data in the database.

When a value is entered in one of the text field I want that value to be only updated in the database.

Ex.

[]id
[]name
[]age
[]address
[]number
[]gender

if name was edited, only the name field would be updated in the database.


As of now heres the code of what Im currently thinking

PHP Code:
if($name)
{
   UPDATE customer
   SET name=value
   WHERE id=id
}

elseif ($age)
{
   UPDATE age
   SET age = age
   WHERE id = id
}
....and so on


Is there an easier way to do this? Or am I stuck with these codes? Hi

I have a form with 6 textfields that will be used to edit data in the database.

When a value is entered in one of the text field I want that value to be only updated in the database.

Ex.

[]id
[]name
[]age
[]address
[]number
[]gender

if name was edited, only the name field would be updated in the database.


As of now heres the code of what Im currently thinking

PHP Code:
if($name)
{
   UPDATE customer
   SET name=value
   WHERE id=id
}

elseif ($age)
{
   UPDATE age
   SET age = age
   WHERE id = id
}
....and so on


Is there an easier way to do this? Or am I stuck with these codes?

View Complete Thread with Replies

Related Items

Query failed: connection to localhost:3354 failed (errno=111, msg=Connection refused).