TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 02-03-2008, 10:39 AM   #1 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default 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
Orc is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 02:26 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design