02-03-2008, 10:39 AM
|
#1 (permalink)
|
|
The Prestige
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
|
Poll System, page blank. :/
PHP Code:
<?php
session_start();
require 'config.php';
?>
<html>
<head>
<title>Poll System</title>
<style>
div.container {
background:#eee;
border:1px solid grey;
padding:.20em;
margin:auto;
display:inline;
}
div.title {
font-family:arial;
font-weight:bold;
color:red;
padding:.10em;
border:1px solid grey;
font-size:15px;
display:block;
}
div.amount {
font-weight:bold;
font-size:15px;
font-family:Helvetica;
color:black;
padding:.10em;
border-left:1px solid grey;
border-bottom:1px solid grey;
display:block;
}
div.option {
font-weight:bolder;
font-size:15px;
font-family:helvetica;
color:black;
display:block;
}
div.bar {
background: url('bar.png') repeat-x;
display:inline;
height:7px;
width:<?php
number_format(ceil($row['amount']));
?>;
}
</style>
</head>
<body>
<?php
$id = $_GET['id'];
$img = '';
if ( isset($id) && !isset($query) )
{
$query = mysql_query("SELECT * FROM `polls` WHERE `id`='$id' LIMIT 5");
while ($row = mysql_fetch_array($query) or die(mysql_error()))
{
if (mysql_num_rows($id)!=0)
{
if (isset($row['options']) || !empty($row['options']))
{
if ($row['title'])
{
print '<div class="title">'.$row['title']."</div><br />";
}
if ($row['options'])
{
for ($i=1;$i<=$row['options'];$i++)
{
$o = $row['options'];
echo '<div class="option">'.$o[$i].'</div>';
}
}
if (strlen($row['amount'])>=1)
{
echo '<div class="amount">'.number_format($row['amount']).'</div><br />';
}
elseif (strlen($row['amount'])==0)
{
echo 'No one has voted yet!';
}
if ($id)
{
$id = $row['id'];
}
}
}
}
}
?>
</body>
</html>
Heres the sql:
sql Code:
CREATE TABLE `polls` ( `id` int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, `title` varchar(20) NOT NULL, `options` varchar(2000) NOT NULL, `amount` varchar(36665) NOT NULL, )ENGINE=INNODB
None of it outputs anything. -_- I suck at making MySQL Applications. BAH!
__________________
VillageIdiot can have my babbies ;d
|
|
|
|