Monthly Archives: November 2015

Reverse a string without built in functions – PHP

Hi all,
Here I share one useful topic related to reverse a string without using inbuilt function.
Reverse a string in PHP is very simple and easy understand. Also PHP provides inbuilt function to reverse a string. The ‘strrev()’ function helps to reverse the string in PHP.




Eg:

<?php
echo strrev(“Helllo World”);
?>

OUTPUT

dlroW olleH

Reverse string without strrev

Next, how to reverse the given string in PHP without using inbuilt function(strrev). For reverse a string first we follow some seps: first assign the given string to a variable and calculate the length of the variabe, declare a variable in which you have to store the reversed string, iterate the string using for loop with appropriate looping and count, concatenate the string inside the for loop, display the reversed string.

CODE








If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Multiselect Option – HTML

Hi all,
We can implement multiselect option in pure HTMl using ‘multiple=”multiple” ‘ in select tag.
This process or operations mainly used in web application like job site( skills,area, prefer work location etc), organization site etc.
We can select multiple values from the menu. we can implement this by jquery plugins and css. Here I implement by pure HTML.




Selecting multiple values with CTRL key

DEMO





CODE






If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Redirect the page using Javascript – HTML or PHP

Hi Friends,
We can redirect the current page to some other new page using Javascript in HTML or PHP page. The window.location object can be used to get the current page address to redirect new page. This operations performe in html page like on page load, onclick event etc. Here I explain redirect the page on page load, redirect the page with time delay, redirect the page with time delay and confirm the alert box and redirect the page on button click.




– – – >Redirect the page on page load

 
 





– – – >Redirect the page with time delay

 
 

Prepare to be redirected!

This page is a time delay redirect!





– – – >Redirect the page with time delay and confirm the alert box

  


Prepare to be redirected!

This page is a time delay redirect!





– – – >Redirect the page on button click



  





– – – >Redirect the Page Only using Search Engines like yahoo,google etc
In above code, the page redirection at particular event or operation. Here I show how to redirect the page or domain to some other page during the page call or search by using search engines. This function perform by using javascript. First check, the call or request from which search engines (AOL|GOOGLE|YAHOO|BING). If request from these specified search enginee then redirect the page using ‘window.location.href’.

	  
	  

– – – >Redirect page on Checkbox check

Create one checkbox and want to redirect a page on some particular link when checkbox is checked.

Create one checkbox

	




Jquery snippet to redirect a page to http://prittytimes.com/ when user checked a checkbox.

	$("#redirect").click(function() {
		var url = "http://prittytimes.com/";
		window.location.href = url;
	});

OR

	$("#redirect").click(function() {
    var url = "http://prittytimes.com";
    $(location).attr('href',url);
  });




If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

SUM the table row values from mysql database – PHP

Here I’m going to discuss about, how to add the table row values using php and mysql. This concept is very simple, we can fetch the data from database add/sum the column values. The values are inserted into database and fetch the values from database, and find the sum values by using SUM(column-name).




Code Explanation:
First, create the database and table ‘addtable’. The ‘addtable’ table contain three field, id,maths,english respectively.
The id is autoincrement and maths,english contain values like mark. Second fetch the data from database using mysql query:





firstadddtable

Second, performe the sum operatio using SUM(column-name).

  
  
S No Maths English
Total





finaladd

FULL CODE



S No Maths English
Total




If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Responsive Client Testimonials Quote Style Carousel Slider

Good Morning to all,
Here I’m going to discussed based on simple responsive quote style carousel slider. By using bootstrap technique we have more features, the quote slider effect in all browser and device with same effect. Slide the quotes with image performe automatically and onclick.This quote style slider is very simple one.
Table Of Content

  • HTML
  • CSS



  • Javascript

demo

HTML

HTML used for display each quotes with image. It’s simple technique. The quotes are specified with class ‘carousel-inner’. Each item specify with class=”item”.
The slider onclick and automatically by performing using javascript.





	

Responsive Client Testimonials Quote Style Carousel Slider





CSS & JAVASCRIPT

CSS and JQUERY file with Bootstrap all important inside the script we have to mention the id ‘quote-carousel’ of slider div












FULL CODE




Simple Responsive Client Testimonials Quote style slider











	

Responsive Client Testimonials Quote Style Carousel Slider




If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Save the HTML or PHP webpage as PDF – JAVASCRIPT

Hi all,
Save the HTML or PHP web page as .PDF format using Javascript. It’s simple and useful, window.print() method is used for saving or printing the page as pdf. The print() method prints the contents of the current window or opens the Print Dialog Box. We have to connect the printer through the computer and choose the path(download/desktop/any folder) and save the web page.The web page save as pdf same web page style.
Three Concept are used for this operation:

  • HTML or PHP
  • Javascript
  • CSS

demo

The HTML






All web page content are specified (div,h1,h2,p,img) here. First div specify the content of HTML page, include both image,heading and paragraph or content.second div used to specify the function call.

	

The HTML

Live HTML compiler using PHP is very simple one like as w3schools editor. In here we are going to run the textarea code in the iframe. Main difference from w3schools try editor,the w3schools try editor used asp.net but, here PHP with iframe is used.Visitors are need to edit their code for their own need, and they want to check it lively HTML live compiler support this operation.

jQuery

Here I am going to tell you interesting topic regarding google map application in web development. Most of the website need googlemap location while we are entering location name, for that we have one solution. Here I explain,when we are entering the location name in input type you will get the map for that particular location by using jquery. It’s very simple and can use in your web development application, this will helps for all the e-commerce site.I hope this concept is really helpful for all developer.

CSS

Responsive menus are built to work with desktop browsers as well as touch and mobile devices.In here the dropdown menu also available in all device using pure CSS. A pure CSS responsive menu created that automatically changes to a toggleable dropdown menu at a specified breakpoint based on CSS3 media queries.If you are having trouble getting your website menu working on an iPhone, iPad, or Android device, then check out these menus.

The Javascript


This is used for performing print operation. Call forprint() from html and performe the operation in javascript, window.print() used for print or save the web page as pdf.

	
	 Click here to Print the Page
	

The CSS


Describe the presentation of an html tags.




FULL CODE



Save the page as .PDF format-Prittytimes.com





The HTML

Live HTML compiler using PHP is very simple one like as w3schools editor. In here we are going to run the textarea code in the iframe. Main difference from w3schools try editor,the w3schools try editor used asp.net but, here PHP with iframe is used. Visitors are need to edit their code for their own need, and they want to check it lively HTML live compiler support this operation.

jQuery

Here I am going to tell you interesting topic regarding google map application in web development. Most of the website need googlemap location while we are entering location name, for that we have one solution. Here I explain,when we are entering the location name in input type you will get the map for that particular location by using jquery. It’s very simple and can use in your web development application, this will helps for all the e-commerce site.I hope this concept is really helpful for all developer.

CSS

Responsive menus are built to work with desktop browsers as well as touch and mobile devices. In here the dropdown menu also available in all device using pure CSS. A pure CSS responsive menu created that automatically changes to a toggleable dropdown menu at a specified breakpoint based on CSS3 media queries. If you are having trouble getting your website menu working on an iPhone, iPad, or Android device, then check out these menus.




If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Count Number of Files in a Directory / Folder – PHP

Hi Guys,
Today I share some useful topic related to two inbuilt function s in php for count number of files in php. The functions are:

  • glob(()
  • count()

Here’s a simple code of PHP code to get the total number of files in a directory using the glob() and count() function.



The first function to discuss is glob() it allows us to perform a search for pathnames using wildcards common to the best known shells.

The count function helps to count all files in specified directory.

count_folder



CODE





the Output will be

Total number Of files in a folder:4

We can count all the files in a folder and also count particular extension files(.jpeg / .php / .pdf etc)



The output will be:

Total number of php file in a folder :3



If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Sum the Table row values – PHP

Here I’m going to discuss about, how to add the table row values using php. This concept is very simple one, and used in organization for accounting purpose or total mark or value related operations.Here the values are declared as array in php, two variables like $a and $b are used for this operation.This same operations can performe mysql with php also.



demo

<?php
$a=array(5,15,25);
$b=array(100,200,300);
echo array_sum($a);
echo array_sum($b);
?>





The $a=array(5,15,25) and $b=array(100,200,300); used for stores multiple values in one single variable, $a contain 5,15,25 and $b stores 100,200,300.
array_sum() function return the sum of all the values in the array.




FULL CODE


Sl No Maths Mark English Mark
1
2
3
Sum




If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Difference between having clause and group by statement

GROUP BY

The group by clause is used for grouping the records of the database table according to our need. Which is an optional part of SELECT statement.

SYNTAX

SELECT column1, column2
FROM table_name
WHERE [ conditions ]
GROUP BY column1, column2
ORDER BY column1, column2




The GROUP BY clause must appear after the FROM and WHERE clauses

Example of Group by in a Statement. Consider following Employee table




Employee_id Employee_name salary
1 Appu 9000
2 Ammu 8000
3 Achu 6000
4 Arathy 10000
5 Ashwathi 8000

Here we want to find name of employees grouped by their salaries. SQL query for the above requirement will be,

SELECT Employee_name from Employee group by salary

The Result will be,

Name
Achu
Ammu
Appu
Arathy

Example of Group by in a Statement with WHERE clause

Employee_id Employee_name salary
1 Appu 9000
2 Ammu 8000
3 Achu 6000
4 Arathy 10000
5 Ashwathi 8000

SQL query will be,

select Employee_name, salary from Employee where Employee_name=’ Ashwathi’ mployee group by salary;

The result will be

Employee_name salary
Ashwathi 8000

NOTE: Group By clause will always come at the end, just like the Order by clause.




HAVING

The HAVING clause must follow the GROUP BY clause in a query and must also precede the ORDER BY clause if used.

SYNTAX

select column_name, function(column_name)
FROM table_name
WHERE column_name condition
GROUP BY column_name
HAVING function(column_name) condition

Example

Employee_id Employee_name salary
1 Appu 2000
2 Ammu 1000
3 Achu 2000
4 Arathy 1000
5 Appu 2000

Suppose we want to find the Employee_name whose salary sum is more than 3000. We will use the below SQL query,

SELECT * from Employee group Employee_name having sum(salary) > 3000

Result will be,

Employee_id Employee_name salary
1 Appu 2000

If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.