WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Example voting script. Lets people enter suggestions and vote for existing ones.
Categories : MySQL, PHP, Cookies, Complete Programs, Databases Update Picture
vote.php3 lerdorf
Date : Aug 07th 1998
Grade : 3 of 5 (graded 11 times)
Viewed : 27178
File : No file for this code example.
Images : No Images for this code example.
Search : More code by vote.php3 lerdorf
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

/*
* Vote Example Script
*
* You can see it in action at http://www.lerdorf.on.ca/nameit.php3
* and you can also get the associated image files there.
*
* The MySQL schema that goes along with this is:
* CREATE TABLE names (
* name varchar(30) DEFAULT '' NOT NULL,
* votes int(4),
* PRIMARY KEY (name)
* );
*/
<? if($vote && !$already_voted) SetCookie("already_voted","1");?>
<html><head><title>Name the Baby Computer</title></head>
<body bgcolor="#ffffff" text="#032F5B" link="#537492" vlink="#000000">
<FONT FACE="Verdana, Arial, Helvetica">
<h3>Name the new baby</h3>
I will be getting a cute little <a
href="http://www.corelcomputer.com">NetWinder</a><img src="tm.gif">
box to stick on my LAN at home soon. It needs a name.
<b><i>something</i></b>.lerdorf.on.ca<p>

Please give me some suggestions or vote for an existing one.
</font>
<form action="vote.php3" method="POST">
Suggestion: <input type=text name=new_name size=25 maxlength=29><P>
<input type=submit value="Submit suggestion and/or vote">
<input type=reset><P>
<?
mysql_pconnect("localhost","","");

if($new_name) {
if(!mysql_db_query("rasmus","insert into names values
('$new_name',0)")) {
print mysql_errno().": ".mysql_error()."<BR>";
}
}
if($vote && $already_voted) {
print "<font color=#ff0000>Hey, you voted already! Vote
ignored.</font><P>\n";
}
else if($vote) {
if(!mysql_db_query("rasmus","update names set votes=votes+1 where
name='$vote'")) {
print mysql_errno().": ".mysql_error()."<BR>";
}
}
$result=mysql_db_query("rasmus","select sum(votes) as sum from names");
if($result) {
$sum = (int) mysql_result($result,0,"sum");
mysql_free_result($result);
}

$result=mysql_db_query("rasmus","select * from names order by votes DESC");
print "<table border=0><tr><th>Vote</th><th>Suggestion</th><th
colspan=2>Votes</th></tr>\n";
while($row=mysql_fetch_row($result)) {
print "<tr><td align=center><input type=radio name=vote value=\"$row[0]
\"></td><td>";
print $row[0]."</td><td align=right>".$row[1]."</td><td>";
if($sum && (int)$row[1]) {
$per = (int)(100 * $row[1]/$sum);
print "<img src=bline.gif height=12 width=$per> $per %</td>";
}
print "</tr>\n";
}
print "</table>\n";
mysql_free_result($result);
?>
<input type=submit value="Submit suggestion and/or vote">
<input type=reset>
</form>
<a href="http://ca.php.net"><img align=top src="php3/logos/mini-logo1.gif"
border=0></a>
<tt><font size=-1><a href="nameit.phps">View Source</a></font></tt>
</body></html>



This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server.
Categories : Databases, MySQL, Complete Programs, PHP, Databases
bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager
Categories : MySQL, PHP, MySQL, Complete Programs, Databases
Create and restore backup of MySQL databases
Categories : MySQL, Databases, PHP, PHP Classes, Complete Programs
Shopping Basket On-Line Ordering System.
Categories : Complete Programs, MySQL, PHP, Ecommerce, Databases
free, search engine, indexing, system, information, web, ftp, http, free, software, cgi, php, MySQL, database, php3, FreeBSD, Linux, Unix, UdmSearch
Categories : MySQL, Complete Programs, PHP, Databases, Search
BBS system for easy customization. Utilizes mySQL.
Categories : Complete Programs, MySQL, PHP, Databases
Tropicalm Genetree Family (MySQL based family tree)
Categories : PHP, Interfaces, Databases, MySQL, Complete Programs
complete, simple, working example of a login screen/system using php functions, cookies, and a mysql database for begginers.
Categories : Authentication, Complete Programs, PHP, MySQL, Databases
Education Center is a set of PHP-scripts to administer a corporate education and examination system via Internet/intranet written in PHP for MySQL.
Categories : PHP, Databases, MySQL, Complete Programs
This is a very simple BBS that uses MySQL
Categories : MySQL, Databases, Complete Programs, PHP
myCSV-dump converts a simple CSV-flatfile-database into an MySQL-dump.
Categories : PHP, MySQL, Databases, Complete Programs
phpAds, a complete banner and ad management system with detailled tracking and stats.
Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases
Point and Click Interface ala MS Access for creating SQL statements.
Categories : MySQL, Complete Programs, General SQL, PHP, Databases
Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs.
Categories : Databases, PHP, MySQL, Complete Programs
AITSH Download
Categories : PHP, Complete Programs, MySQL, Databases