Posts

Showing posts from April, 2010

reddit style voting in php mysql jquery

Image
This tutorial will show you how to create such a voting system with jQuery, PHP and MySQL. I created a table called entries where there are 5 columns: id — The unique id associated with each entry title — The title of the entry to be shown as a link to the site votes_up — The total number of people who voted up. votes_down — The total number of people who voted down. Fetch The Data Now, we have the table and the data. Let's show the data. We create a config.php file that holds all our database credentials. <? $hostname = "localhost"; $db_username = "your_username"; $db_password = "your_password"; $db_password = "your_database"; $link = mysql_connect($hostname, $db_username, $db_password) or die("Cannot connect to the database"); mysql_select_db($db_password) or die("Cannot select the database"); ?> What we did is just connect to the database. Do replace your_username, your_password and your_datab

twitter style update message display script

Hello Friends Here is the script to display confirmation or error message in twitter style.  You just need to write the message in   <div id="alert"> ...............</div> whatever you want . After that add the javascript code written below. <style type="text/css"> body { background-color: #ccc; color: #000; } #alert { overflow: hidden; width: 1260px; text-align: center; position: absolute; top: 0; left: 0; background-color: #fff; height: 0; color: #000; font: 20px/40px arial, sans-serif; opacity: .9; } </style> <div id="alert"> Thank you. Your message has been sent </div> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $(function () { var $alert = $('#alert'); if($alert.length) { var alerttimer = window.setTimeout(function () {