Skip to main content

Posts

Showing posts from March, 2017

Inheritance in object-oriented PHP

PHP oops concept : One of the main advantages of object-oriented programming is the ability to reduce code duplication with inheritance, code duplication means reduces same function/method write multiple time.code duplication occurs when same code write more than one. In inheritance we have one parent class and other is child class, parent class having properties can access child class. Code : https://drive.google.com/open?id=0BxmTZPVcu72fbUJaS3lCQUVvYmM Demo: http://freeteachnology.hol.es/Inheritance/ How to create classes? In order to create a class, we group the code that handles a certain topic into one place. For example, we can group all of the code that handles the users of a blog into one class, all of the code that is involved with the publication of the posts in the blog into a second class, and all the code that is devoted to comments into a third class. Syntax: class <Class-name>() { //write something code::- } Eg: class MyCo...

Binary search in php

Binary search in php 1-PHP Binary Search Array is used to search the given value in the array. 2-In php there is no function for the binary search like java or other language. Binary search algorithm in PHP Binary search is a search algorithm that is dramatically faster than PHP’s internal functions (such as array_search) when searching ordered data. Demo link : http://freeteachnology.hol.es/binarySearch/ Code link : https://drive.google.com/open?id=0BxmTZPVcu72fd1dnTFRpS2w2Uk0 Demo code run : Binary search implementation : 1-first create array, 2-check middle value in array, 3-search value and middle value is equal then search value found, 4-if search value is less than middle calculated value then again search left side if search value should be found or not, 4-if search value is greater than middle calulcated value search right side now, The binary search is perhaps the most famous and best suitable search algorithm for sorted...

create mysql view,update,drop etc view operation.

View is a data object which does not contain any data. Contents of the view are the resultant of a base table. They are operated just like base table but they don’t contain any data of their own. The difference between a view and a table is that views are definitions built on top of other tables (or views). If data is changed in the underlying table, the same change is reflected in the view. A view can be built on top of a single or multiple tables. A database view is known as a “virtual table” that allows you to query the data in it. Understanding the database views and using them correctly are very important. we will discuss the database views, how they are implemented in MySQL,A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database. Introduction to Database View Why views ? 1-Views can be effective copies of base tables. 2-Views can be used in INSERT/UPDATE/DELETE. 3-Views can be views of vie...

jQuery Method hasClass,animations,fadeIn,fadeOut,eq

What is jQuery‭ ‬: JQuery is a JavaScript library which is small, quick, with tons of features that makes things such as animation, event handling and manipulation in web browser easy to use and handle. 1-jQuery is a fast and concise JavaScript Library created by John Resig in‭ ‬2006‭ ‬with a nice motto‭ ‬-‭ 2-Write less,‭ ‬do more.‭ 3-jQuery simplifies HTML document traversing,‭ ‬event handling,‭ ‬animating,‭ ‬and Ajax interactions for rapid web development. jQuery hasClass() Method Determine whether any of the matched elements are assigned the given class Syntax : .hasClass(className) The hasClass(class) method returns true if the specified class is present on at least one of the set of matched elements otherwise it returns false. Code : <html> <head> <title>The Selecter Example</title> <script type = "text/javascript" src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/query.min.js">...

using PDO database connection add,update,delete,edit operation

PDO advantage : 1-Object Oriented 2-Bind parameters in statements (security) 3-Allows for prepared statements and rollback functionality (consistency) 4-Throws catcheable exceptions for better error handling (quality) 5-Exception mode; no need to check error state after each API call. It's best to tell PDO how you'd like the data to be fetched. You have the following options: 1-PDO::FETCH_ASSOC: returns an array indexed by column name. 2-PDO::FETCH_BOTH: (default):returns an array indexed by both column name and number. 3-PDO::FETCH_BOUND:Assigns the values of your columns to the variables set with the ->bindColumn() method. 4-PDO::FETCH_CLASS: Assigns the values of your columns to properties of the named class. It will create the properties if matching properties do not exist. 5-PDO::FETCH_INTO:Updates an existing instance of the named class. 6-PDO::FETCH_LAZY: Combines. 7-PDO::FETCH_BOTH/PDO:FETCH_OBJ, creating the object variable names as t...