<div>Hello All,</div>
<div> </div>
<div>I have a question for array, I am using:</div>
<div>- Apache version 2.0.58</div>
<div>- PHP version 4.4.3-dev</div>
<div>- MapServer 4.8.3 CGI and MapScript (CSharp, Java, PHP, <br> Python)</div>
<div>In PostgreSQL database, I create a array called purchase_factor varchar[], this arrary should get data from checkbox.</div>
<div>I tried the different scripts:</div>
<div> </div>
<div>1)</div>
<div> $purchase_factor = array<br> ("clim" => "!isset($_POST['ChkHomeFactor_clim']? NULL: pg_escape_string($_POST</div>
<div>['ChkHomeFactor_clim']))","dist" => "!isset($_POST['ChkHomeFactor_dist']? NULL: pg_escape_string($_POST</div>
<div>['ChkHomeFactor_dist']))");</div>
<div> </div>
<div>and </div>
<div> </div>
<div> foreach ($purchase_factor as $key => $value) {<br> $result = pg_execute($db, purchase_factor($key, $value));<br> if (!$result) {<br> die("Error in SQL query (country '$key'): " . pg_last_error());
<br> }<br> } </div>
<div>2)</div>
<div> </div>
<div>$purchase_factor = array();<br> array_push($purchase_factor, <br> "!isset($_POST['ChkHomeFactor_clim']? NULL: pg_escape_string($_POST['ChkHomeFactor_clim']))",<br> "!isset($_POST['ChkHomeFactor_dist']? NULL: pg_escape_string($_POST['ChkHomeFactor_dist']))",
<br> "!isset($_POST['ChkHomeFactor_atmo']? NULL: pg_escape_string($_POST['ChkHomeFactor_atmo']))",<br> "!isset($_POST['ChkHomeFactor_recr']? NULL: pg_escape_string($_POST['ChkHomeFactor_recr']))",
</div>
<div> "!isset($_POST['ChkHomeFactor_fami']? NULL: pg_escape_string($_POST['ChkHomeFactor_fami']))",<br> "!isset($_POST['ChkHomeFactor_priv']? NULL: pg_escape_string($_POST['ChkHomeFactor_priv']))",
<br> "!isset($_POST['ChkHomeFactor_envi']? NULL: pg_escape_string($_POST['ChkHomeFactor_envi']))",<br> "!isset($_POST['ChkHomeFactor_cost']? NULL: pg_escape_string($_POST['ChkHomeFactor_cost']))",
<br> "!isset($_POST['ChkHomeFactor_area']? NULL: pg_escape_string($_POST['ChkHomeFactor_area']))",<br> "!isset($_POST['ChkHomeFactor_inve']? NULL: pg_escape_string($_POST['ChkHomeFactor_inve']))",
<br> "!isset($_POST['ChkHomeFactor_othe']? NULL: pg_escape_string($_POST['ChkHomeFactor_othe']))");</div>
<div> </div>
<div>both methods were not working....no error, but the data did not be writen into table..............</div>
<div> </div>
<div>and I found online help:</div>
<div> </div>
<p><b>Note: </b>A limitation of the present array implementation is that individual elements of an array cannot be SQL NULLs. The entire array can be set to NULL, but you can't have an array with some elements NULL and some not. Fixing this is on the to-do list.
</p>
<div>Since this array get data from a checkbox, it's element might be null. If anyone is familiar with this question and give me some suggest, I really appreciate your time and help.</div>
<div> </div>
<div>All the best wishes for you all in the new year!</div>
<div> </div>
<div>Crystal<br>-- <br>=========================<br>Crystal Li<br>Systems Analyst<br>Idisis, Inc.<br>430, 318 11th Avenue S.E.<br>Calgary, Alberta T2G 0Y2<br><a href="http://www.idisis.com">www.idisis.com</a><br>E-mail:
<a href="mailto:crystal.li@idisis.com">crystal.li@idisis.com</a><br>Office: (403)670-7351<br>Fax: (403) 670-7359 </div>