Phpmysql voting system development example tutorial (1/4)-PHP source code

Source: Internet
Author: User
Ec (2); let's first analyze process 1, database tutorial, 2, database file dbconn. php 3, vote. php vote page 4, vote function page vote_add.php 5, view all voting data viewpoll. php now let's take a look at the database structure & nbsp; the Code is as follows: copy the code dropdatabaseifexistsvote; createdatabase script ec (2); script

Let's first analyze the process

I. Database tutorial,

2. database file dbconn. php

Iii. vote. php voting page

4. vote_add.php

5. View All voting data viewpoll. php

Now let's look at the database structure

The Code is as follows:

Drop database if exists vote;
Create database vote;
Use vote;

Create table title (
Id int (6) not null auto_increment,
Username varchar (20) not null,
Email varchar (50) not null,
Title varchar (250) not null default '',
Types tinyint (2) not null default '1 ',
Choice text,
Times datetime not null default '2017-00-00 00:00:00 ',
Primary KEY (id)
);

Create table vote (
Id int (6) not null auto_increment,
Titleid int (6) not null default '0 ',
Info text not null,
Vcount int (4) not null default '0 ',
Primary KEY (id)
);
Create table email (
Id int (6) not null,
Email varchar (50) not null,
Primary key (id, email)
);

Database Connection File

The Code is as follows:

$ Conn = mysql_connect ("localhost", "phpdb", "phpdb ")
Or die ("cannot connect to the database server:". mysql_error ());
Mysql_select_db ("vote", $ conn) or die ("the database cannot be selected:". mysql_error ());

?>

Homepage 1 2 3 4 last

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.