polling system part 1 creating php & mysql files cis 254
Post on 01-Jan-2016
219 Views
Preview:
TRANSCRIPT
Polling System Part 1
Creating PHP & MySQL Files
CIS 254
Polling System
• Create Database
• Upload Table information through PHP
• Creating Require() Files
• Add Polls
• Load Poll Data
• Vote For– Setting Cookies
Create Database
• Using Telnet and MySQL Admin– Create DB INTpoll– Set Permissions
• GRANT for DB and TABLE
Upload Table information through PHP
• In A PHP File, – Create connection to database – Create table in mysql_query statement– Insert tQable data in mysql_query statement– One statement per INSERT statement– Use echo mysql_error for troubleshooting
Creating Require() Files
• Allow you to insert information from a outside file into a current file.– Useful for headers, footers and commonly
required variables.
• Create Connect.php
• Use REQUIRE() for connection variables
• Commonly called includes
Add Polls
• File used to input poll questions into system
• Poll questions come from database
• See file addpolls.php
Load Poll Data
• Loads Questions into Flash according to selection. – See loadpolldata.php
Vote For
• Check for previous votes– Using a cookie
• Update record with votes
• Send poll data back to flash– See votefor.php
Setting Cookies
• Cookies allow tracking of previous votes
top related