General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old January 24th, 2003, 05:31 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
foreach + serialize question

so I got my poll so that I can add polls,..no problem,....I can echo the serialized/unserialized data into input fields for editing

PHP Code:
<?php
    $poll_answers 
unserialize(stripslashes($poll['choices']));
    
reset($poll_answers);
    foreach(
$poll_answers as $entry)
    {
        
$id $entry[0];
        
$choice $entry[1];
        
$votes  $entry[2];
    
?>
        <tr>
            <td><strong>Answer <?php echo $entry[0]; ?></strong></td>
            <td>
                <input class="forminput" type="text" name="answer[]" value="<?php echo $entry[1]; ?>" /> - <?php echo $entry[2]; ?>
                <input type="hidden" name="votes[]" value="<?php echo $entry[2]; ?>" />
            </td>
        </tr>
<?php ?>



What I can't figure out is how to recreate the serialized array again to preserve the posts for each poll answer.

In other words, If I wanted to edit an answer and maybe change the wording,..or whatever,....and there are posts for that answer already,....how can I preserve that number and put it back into the serialized array to store in the db?
__________________
-- Jason

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > foreach + serialize question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway