3 Replies - 2452 Views - Last Post: 24 September 2012 - 12:53 PM Rate Topic: -----

#1 yakult02  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 26
  • Joined: 04-December 09

Online Voting System

Posted 24 September 2012 - 04:19 AM

Hi I'm Ja and I'm a student. Im about to make an online voting system from president down to partylist. I'll do the coding but im gonna need to ask few questions like where im gonna put the database? and how to connect it. Thanks a lot dudes. :)
Is This A Good Question/Topic? 0
  • +

Replies To: Online Voting System

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,990
  • Joined: 08-June 10

Re: Online Voting System

Posted 24 September 2012 - 04:44 AM

You normally put the database on a server computer. Then you'd connect to the database server using either PDO or a database-specific API like MySQLi.

For small sites, the database server and the HTTP server hosting the PHP site are often on the same host computer, in which case you connect to "localhost" when making the database connection.

The alternative is to use a "local" database, like SQLite or a simple CSV file. It won't require an actual database server, but will instead rely on a file (or files) to store the data.
Was This Post Helpful? 1
  • +
  • -

#3 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,205
  • Joined: 19-January 10

Re: Online Voting System

Posted 24 September 2012 - 12:41 PM

Yeah for smaller projects I usually use my own little database framework thingy that uses files (instead of bringing a mysql database into the mix). But really, file_put_contents and file_read_contents work just find. The whole point of databases is so that it's easier to manage data (or so I think), and when the most data you're going to have is a few numbers it's not really necessary to use one.

So if you're planning on making just one poll I would use a file to store the votes and such. However if you're planning on making multiple polls you should look into MySQLi or PDO for connecting to your database.
Was This Post Helpful? 0
  • +
  • -

#4 nightscream  Icon User is offline

  • D.I.C Head

Reputation: 19
  • View blog
  • Posts: 237
  • Joined: 04-December 08

Re: Online Voting System

Posted 24 September 2012 - 12:53 PM

If you don't really want to use a database you should use sqlite (file based database). Or if you really want something simple like creativecoding has. Create an array with key = tablename and has an array.

This array should be serialized in a text file and unserialized when you read it. It's easy to store and you don't need a big class with "complex" functions.

This post has been edited by nightscream: 24 September 2012 - 12:53 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1