• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 325
  • Last Modified:

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?
0
m2ew
Asked:
m2ew
1 Solution
 
Chris WongCommented:
use the isset() instead
0
 
Loganathan NatarajanLAMP DeveloperCommented:
what is the database type which you insert?
0
 
V4nP3rs13Commented:
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
0
 
m2ewAuthor Commented:
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.
0
 
m2ewAuthor Commented:
Converted column from int to varchar and it worked
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now