Mam problem z sondą otóż tym kodem pobieram pytania, odpowiedzi i ilosc odpowiedzi do ostatniej sondy, probem w tym, że źle mi je wyświetla :/
Kod poll.php
  1. <?php
  2. $mysql = new MySQL;
  3. $db_query = "SELECT * FROM $tbl_poll WHERE ended='' LIMIT 1";
  4. $mysql -> fetch_assoc($db_query);
  5. $smarty -> assign('question', $mysql -> row);
  6. foreach ($mysql -> row as $Poll) {
  7. for ($i = 0; $i <= 11; $i++) {
  8. if (!empty($Poll['answer_'.$i])) {
  9. $answers[] = $Poll['answer_'.$i];
  10. }
  11. }
  12. $PollId = $Poll['id'];
  13. }
  14. $mysql = new MySQL;
  15. $db_query = "SELECT * FROM $tbl_poll_answers WHERE question_id='".$PollId."'";
  16. $mysql -> fetch_assoc($db_query);
  17. $smarty -> assign('answers', $answers);
  18. $smarty -> assign('votes', $mysql -> row);
  19. $smarty -> display("$theme/menu.tpl");
  20. ?>

menu.tpl
  1. {foreach from=$question item=question}
  2. <b>{$question.question}</b><br />
  3. {/foreach}
  4. {foreach from=$answers item=answer}{foreach from=$votes item=vote}
  5. &raquo; {$answer}:<br />
  6. {$vote.votes}<img src="templates/{$theme}/images/bg_01.gif" height="10" width="1" style="border: 1px solid #000000"><br />
  7. {/foreach}{/foreach}

Struktura MySQL
Cytat
cms_poll
id | question | answer_1 | answer_2 | ... | answer_10 | started | ended
np.
1 | OK ? | Tak | Nie | Może | null od answer_4 do 10 | 13.11.2006 | |
---
cms_poll_answer
id | question_id | votes
np
1 | 1 | 123
2 | 1 | 15
3 | 1 | 0

wyświetla mi tak
Cytat
OK ?
» Tak:
123
» Tak:
15
» Tak:
0
» Nie:
123
» Nie:
15
» Nie:
0
» Może:
123
» Może:
15
» Może:
0


co robie (znowu?) źle ?