Advertisement
AaEzha

AaEzha.com - Polling Sederhana - polls.php

Dec 11th, 2012
2,750
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?
  2. mysql_connect('localhost','DB_USER','DB_PASS'); mysql_select_db('DB_NAME');
  3. $pol = $_POST['pol'];
  4.  
  5. $query = "select jumlah from polling where opsi='$pol'";
  6. $result = mysql_query($query);
  7. $tcount = mysql_fetch_array($result);
  8. $tcount = $tcount['jumlah']+1;
  9.  
  10. $query1 = "update polling SET jumlah='$tcount' where opsi='$pol'";
  11. $result1 = mysql_query($query1);
  12.  
  13. echo "<h2><p align='center'>Total vote untuk $pol sementara adalah : ".$tcount."</p></h2>";
  14. echo "Hasil voting sementara adalah:";
  15. $html = mysql_fetch_array(mysql_query("select jumlah from polling where opsi='HTML'"));
  16. echo "<br>HTML : ".$html['jumlah']." suara";
  17. $php = mysql_fetch_array(mysql_query("select jumlah from polling where opsi='PHP'"));
  18. echo "<br>PHP : ".$php['jumlah']." suara";
  19.  
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement