swift - MySQL: why is 'true' saved as 0? -


i have db in mysql column of table boolean:

`eligibilitydate` tinyint(1) not null 

data arrive ios swift app through following functions:

let postparams = "action=save_report&id_fish=\(reporting.fishid)&fish_name=\(reporting.fishname)&detectedsize=\(reporting.detectedsize)&eligibilitysize=\(reporting.eligibilitysize)&eligibilitydate=\(reporting.eligibilitydate)&origin=\(reporting.origin)&production=\(reporting.production)&townreport=\(reporting.townreport)"  request.httpbody = postparams.datausingencoding(nsutf8stringencoding) 

where guess bool variables eligibilitydate , eligibilitysize converted true/false 'true'/'false'. anyway seems 'true' value saved 0 in mysql...why? correct way?

update

a possible solution this:

let postparams = "action=save_report&id_fish=\(reporting.fishid)&fish_name=\(reporting.fishname)&detectedsize=\(reporting.detectedsize)&eligibilitysize=\(reporting.eligibilitysize ? 1 : 0)&eligibilitydate=\(reporting.eligibilitydate ? 1 : 0)&origin=\(reporting.origin)&production=\(reporting.production)&townreport=\(reporting.townreport)"


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -