jQuery and PHP inline editing

Ajax, PHP Scripts, Tutorials
Inline altering as its known, or having the capacity to alter substance straightforwardly on a page is an incredible instrument have added to your repertoire. I'm set to run through precisely how it fills in and also how to Post the redesigned content through to a Php script for server side handling to put in the database. The Code It looks a little complex so i'm set to rapidly run through precisely what's going on. At the time you visit the demo page are given a piece of content. Assuming that you float your rodent over the content you'll see a little alter symbol comparative to when you need to alter substance on Facebook. Provided that the client clicks on the square of code the content is reinstated with a…
Read More

Easy PHP Pagination

PHP, PHP Scripts, Tutorials
We had a couple of pagination scripts through the years yet I supposed i'd impart the particular case that i'm presently utilizing as its an of service script to have in your tool stash. As a designer you'll soon discover a requirement to paginate information when showing substance from the database, and instead of utilization Javascript which could require all the information to be stacked into the page on burden, we can utilize Php to guarantee that we're just asking for the information that we need from the database. For those who have no idea what i'm discussing. Pagination is a path of part up information into reasonable pieces to presentation to a client, assuming that you've used more than two minutes on the web chances are you've come into…
Read More

Country drop down list with php function

Databases, PHP, PHP Scripts, Tutorials
I had a venture as of late that needed the client to select their nation from a drop down record and store the information in a database. It was such a long process setting up the Php switch proclamation that I supposed somebody may find it handy for an activity. The code underneath is a depiction of the switch proclamation I've setup. The download at the lowest part incorporates 238 nations and mainlands. You recently need to store the nation code in the database then call the capacity beneath to furnish a proportional payback name. Download full code from here
Read More

Create an error page to handle all errors with PHP

PHP, PHP Scripts, Tutorials
Here's an exceptionally modest result for taking care of a mixed bag of Http mistakes like 404, 500.. and so on in one php index. All we have to do is make a cluster of lapse codes and match against them by getting the worldwide redirect status code utilizing Php. This implies that we can utilize one page the handle various blunders. The Code You'll have to overhaul your .htaccess document so when a mistake is recognized the server knows how to handle the solicitation. For our situation we're set to send all the recorded slips to our nonexclusive errors.php record. ErrorDocument 400 /errors.php ErrorDocument 403 /errors.php ErrorDocument 404 /errors.php ErrorDocument 405 /errors.php ErrorDocument 408 /errors.php ErrorDocument 500 /errors.php ErrorDocument 502 /errors.php ErrorDocument 504 /errors.php The PHP This is the…
Read More

Automatic jQuery site subscription lightbox

Ajax, Tutorials, Web Design & Programming
Getting Started You’ll need to include the jQuery library as well as the Colorbox lightbox JS and CSS which are included in the download below. <!-- Color Box CSS --> <link media="screen" rel="stylesheet" target="_blank" href="css/colorbox.css" /> <!-- Style For the Subscription Box --> <link media="screen" rel="stylesheet" target="_blank" href="css/popup.css" /> http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js http://js/colorbox.js The JS Code Once the page loads we check to see if the cookie exists and hasn’t expired. If it’s expired or doesn’t exist we set the cookie to expire in 15 days, and we show the lightbox. $("document").ready(function (){ // load the overlay if (document.cookie.indexOf('visited=true') == -1) { var fifteenDays = 1000*60*60*24*15; var expires = new Date((new Date()).valueOf() + fifteenDays); document.cookie = "visited=true;expires=" + expires.toUTCString(); $.colorbox({width:"580px", inline:true, href:"#subscribe_popup"}); } $(".open_popup").colorbox({width:"580px", inline:true, href:"#subscribe_popup"}); }); The HTML Here’s the HTML…
Read More

Simple MySQL database access wrapper

Databases, PHP, Tutorials
This class is a basic Mysql database access wrapper. It can: -Establish an association with a given Mysql server host -Execute Sql questions -Retrieve question comes about into exhibits -Retrieve the outcome set number of columns, final embedded identifier or the amount of influenced columns -Check if a database table record exists matching a given condition -Retrieve the amount of records that a table has matching a given condition Below is class: class.php: <?php class WGDB{ public $connection ; public $querycount = 0; public function db() {} public function connect($dbhost, $dbusername, $dbpassword) { $this->connection = mysql_connect($dbhost,$dbusername,$dbpassword); return $this->connection; } public function close() { return mysql_close( $this->connection ); } public function select_db($databasename) { return mysql_select_db($databasename,$this->connection); } public function exist($tablename, $fieldname, $value, $where = false) { $exist = $this->fastfetch("select * from `$tablename` where `$fieldname` = '$value' ".check($where, " $where").""); return check($exist['id'], true, false); } public function count($tablename, $where = false) { $query = $this->query("select * from `$tablename` ".check($where, "where $where").""); return $this->fetchnum($query); } public function query($sql) { $this->querycount++; return mysql_query($sql,$this->connection); } public function fastfetch($sqlcode, $type = MYSQL_BOTH ) { $query = $this->query($sqlcode) ; return $this->fetcharray($query, $type); } public function fetcharray($query, $type = MYSQL_BOTH ) { return mysql_fetch_array($query, $type); } public function fetchassoc($query) { return mysql_fetch_assoc($query); } public function fetchnum($query) { return mysql_num_rows($query); } public function fetchobject($query) { return mysql_fetch_object($query); } public function escape($string) { return mysql_escape_string($string);…
Read More

Validation with jQuery

Ajax, Tutorials
This time I need to clarify about "Form acceptance utilizing standard outflows with jquery". I had advanced an excercise utilizing jquery.validate plugin, It's extremely straightforward. Actualize this and improve your web tasks. http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js http://jquery.validate.js $(document).ready(function() { $.validator.addMethod("email", function(value, element) { return this.optional(element) || /^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+.[a-zA-Z.]{2,5}$/i.test(value); }, "Please enter a valid email address."); $.validator.addMethod("username",function(value,element) { return this.optional(element) || /^[a-zA-Z0-9._-]{3,16}$/i.test(value); },"Username are 3-15 characters"); $.validator.addMethod("password",function(value,element) { return this.optional(element) || /^[A-Za-z0-9!@#$%^&*()_]{6,16}$/i.test(value); },"Passwords are 6-16 characters"); // Validate signup form $("#signup").validate({ rules: { email: "required email", username: "required username", password: "required password", }, }); }); Download Script
Read More

AJAX File Uploader

Ajax, PHP, Tutorials
This class might be utilized to scan records transferred through Web shapes utilizing Ajax strategies to send the records without reloading the shape page. There is helper Javascript code that can transfer out of sight a record that the clients picks in a Web page shape and overhauls the transfer memo status in the page. A server side helper script gets the transferred indexes and duplicates to a transfer index. The class might be utilized to output the transfer index and record the formerly transferred documents as per diverse sorts: picture, sound, film and other. Download file from here
Read More