The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled PHP Code
Posted by: ss | October 27, 2010 @ 9:42am
PHP Code
[
Download
]
<?php $query_anketa = $modx->db->query(" SELECT id, pagetitle, content FROM site_content WHERE parent=56 AND published=1 AND deleted=0 ORDER BY ID DESC LIMIT 1 "); $anketa = $modx->db->makeArray($query_anketa); $anketa_id = $anketa[0]['id']; $query_odgovori = $modx->db->query(" SELECT id, value FROM site_tmplvar_contentvalues WHERE contentid=$anketa_id AND tmplvarid!=18 "); $odgovori= $modx->db->makeArray($query_odgovori); $rezultati = $modx->db->getValue("SELECT value FROM site_tmplvar_contentvalues WHERE contentid=$anketa_id AND tmplvarid=18"); echo ' <form action="" method="post" id="pool"> <p>'.$anketa[0]['content'].'</p> <table> '; foreach($odgovori as $s){ echo ' <tr> <td><input type="radio" name="question" value="'.$s['id'].'"/></td> <td class="odg">'.$s['value'].'</td> </tr> '; } $rezultati2=unserialize($rezultati); if($rezultati2[$_POST['question']]) { $rezultati2[$_POST['question']]=$rezultati2[$_POST['question']]+1; } else { $rezultati2[$_POST['question']]=1; } echo '</table> <p> <br /> <input type="submit" value="Glasuj" class="submit" /> </p> <p> <a href="[~59~]" class="arrow">Poglej rezultate ankete</a> </p> </form>'; if(empty($rezultati)) { $res= serialize($rezultati2); $query_rezultat = $modx->db->query(" INSERT INTO site_tmplvar_contentvalues(tmplvarid, contentid, value) VALUES ('18', '$anketa_id','$res'); "); } else { $res= serialize($rezultati2); $query_rezultat = $modx->db->query(" UPDATE site_tmplvar_contentvalues SET value='$res' WHERE tmplvarid =18 AND contentid =$anketa_id; "); } /* echo'<pre style="position:absolute;font-size:9px;background:#FFF; padding:20px;">'; $res2 = unserialize($res); echo '<br/>Rezultati:<br/><br/><table>'; foreach($odgovori as $s){ echo ' <tr> <td style="padding:10px;">'.$s['value'].'</td> <td style="padding:10px;">'.$res2[$s['id']].'</td> </tr> '; } echo '</table><br/><br/>'; print_r ($rezultati2); echo'</pre>'; */ ?>
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.55 / 8
42 Votes
http://codebin.yi.org/922
page generated in 0.00 seconds