Skip to main content

Posts

Showing posts from 2014

Auto complete text box with PHP, jQuery and MySql

In this tutorial I want to show you how easy to do a auto complete text box with PHP, jQuery and MySql. Creating database table We need to create a table in our database before writing our script. I also add some data for this table. Import following SQL statement via phpMyAdmin or any other MySQL tool. CREATE TABLE `tag` ( `id` int ( 20 ) NOT NULL auto_increment , `name` varchar ( 50 ) NOT NULL , PRIMARY KEY ( `id` ) ) ENGINE = MyISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT = 10 ; INSERT INTO `tag` ( `id` , `name` ) VALUES ( 1 , 'php' ), ( 2 , 'php frameword' ), ( 3 , 'php tutorial' ), ( 4 , 'jquery' ), ( 5 , 'ajax' ), ( 6 , 'mysql' ), ( 7 , 'wordpress' ), ( 8 , 'wordpress theme' ), ( 9 , 'xml' ); index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"

Interview Questions For PHP

    •    What is PHP? PHP is a server side scripting language commonly used for web applications. PHP has many frameworks and cms for creating websites.Even a non technical person can cretae sites using its CMS.WordPress,osCommerce are the famus CMS of php.It is also an object oriented programming language like java,C-sharp etc.It is very eazy for learning     •    What is the use of "echo" in php? It is used to print a data in the webpage, Example: <?php echo 'Car insurance'; ?> , The following code print the text in the webpage     •    How to include a file to a php page? We can include a file using "include() " or "require()" function with file path as its parameter.     •    What's the difference between include and require? If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution wi

First Jquery Program

<html>     <head>          <script src="as.js"> </script>                  <script> $(document).ready(function(){ $('button').click(function() { $('p').hide(); }); }); </script>                                   </head>          <body>            <p>Hi Click ME.......</p>            <button>CLICK ME</button>        </body>                   </html>

ARRAY In PHP

ARRAY An array stores multiple values in one single variable: <!DOCTYPE html> <html> <body> <?php $cars=array("Volvo","BMW","Toyota");  echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . "."; ?> </body> </html> In PHP, there are three types of arrays: Indexed arrays  - Arrays with numeric index Associative arrays  - Arrays with named keys Multidimensional arrays  - Arrays containing one or more arrays PHP Indexed Arrays There are two ways to create indexed arrays: The index can be assigned automatically (index always starts at 0): <!DOCTYPE html> <html> <body> <?php $cars=array("Volvo","BMW","Toyota");  echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . "."; ?> </body> </html> Get The Length of an Array -

PHP functions

PHP User Defined Functions Create a User Defined Function in PHP A user defined function declaration starts with the word "function": <!DOCTYPE html> <html> <body> <?php function writeMsg() {    echo "Hello world!"; } writeMsg(); ?> </body> </html> PHP Function Arguments <!DOCTYPE html> <html> <body> <?php function familyName($fname) {    echo "$fname Refsnes.<br>"; } familyName("Jani"); familyName("Hege"); familyName("Stale"); familyName("Kai Jim"); familyName("Borge"); ?> </body> </html> ==================================================================== <!DOCTYPE html> <html> <body> <?php function familyName($fname,$year) {    echo "$fname Refsnes. Born in $year <br>"; } familyName("Hege","1975"); familyName("Stale","1978&qu