dolcezza Posted January 16, 2008 Share Posted January 16, 2008 I wanted to put the array(mileage,hotel...) in the database and I am getting the word "array". 'm confused as to how to get it to put in the values. (posting only relevant code). I moved this from the php forum because it is going into the databae as "array". It is coming from: <input type="checkbox" name="travelinc[]" value="mileage">mileage <input type="checkbox" name="travelinc[]" value="flight">flight <input type="checkbox" name="travelinc[]" value="hotel">hotel <input type="checkbox" name="travelinc[]" value="perdiem">per diem</p> then used as: $travelinc = ($_POST['travelinc']); $query = "UPDATE events SET address='$address', city='$city', state='$state', zip='$zip', directions='$directions', honorarium='$honorarium', travelexp='$travelinc', sig='$sig', other='$eventnotes' WHERE eventid = '$eventid'"; $how_many = count($travelinc); if ($how_many>0) { $travelinc = 'N/A'; } for ($i=0; $i<$how_many; $i++) { $pdf->MultiCell(0,5, $travelinc[$i] . ", ",0,0); Quote Link to comment Share on other sites More sharing options...
fenway Posted January 16, 2008 Share Posted January 16, 2008 You can't -- that is, you shouldn't. Quote Link to comment Share on other sites More sharing options...
dolcezza Posted January 16, 2008 Author Share Posted January 16, 2008 even if the only way I am using it is as an array? I just need to be able to print it as : travel expenses include: mileage, hotel.... Quote Link to comment Share on other sites More sharing options...
jaymc Posted January 16, 2008 Share Posted January 16, 2008 $doit = serialize($thearray) put that in the field, will look like shit then pull it out and do $redoit = unserialize($data[field]) Bang, you got your array back Quote Link to comment Share on other sites More sharing options...
dolcezza Posted January 16, 2008 Author Share Posted January 16, 2008 I am both inserting it, and using it on the same page... so if I serialize, then insert, I can still use unserialize even though I am not pulling it out of the database? In which case would it be something like: $redoit = unserialize($doit) ? Quote Link to comment Share on other sites More sharing options...
fenway Posted January 17, 2008 Share Posted January 17, 2008 It's still a poor choice. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.