Link to home
Start Free TrialLog in
Avatar of Mike Tew
Mike TewFlag for Canada

asked on

php form post to database

I'm updating a database from form post via php. However, I'm getting a error when 0 (aka. zero) is the value, and its being dropped from the value being posted to the database. Is this a result of my table formatting in mysql?
Avatar of Chris Wong
Chris Wong
Flag of Hong Kong image

use the isset() instead
ASKER CERTIFIED SOLUTION
Avatar of Loganathan Natarajan
Loganathan Natarajan
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can we see the code? Is the code for getting the value like this:
$fieldOne = addslashes($_POST['fieldName']);

and the mysql query:
mysql_query("UPDATE table_name SET some_column = '$fieldOne' WHERE id = 'id_number'");

I hope this will solve the problem
Avatar of Mike Tew

ASKER

I'm still learning mysql, the query is correct. Fixed the issue though, the issue was that field was int not varchar.  Now that I have switched, not problems with updating. Thanks for the hint logudotcom.
Converted column from int to varchar and it worked