Wednesday, 17 December 2014

jQuery One Page Nav

Click Here to Download....

jQuery One Page Nav

A lightweight jQuery plugin for the navigation on one-page sites. Adds smooth scrolling when clicking on the navigation and automatically selects the correct navigation items as you are scrolling through the different sections.

Usage

$(document).ready(function() {
 $('#nav').onePageNav();
});

Markup

<ul id="nav">
 <li class="current"><a href="#intro">Intro</a></li>
 <li><a href="#usage">Usage</a></li>
 <li><a href="#examples">Examples</a></li>
</ul>

Options

  • currentClass: Class to add to the nav to indicate the current item. Defaults to current.
  • changeHash: Whether you want to change the hash when a user clicks on the nav. Defaults to false.
  • scrollSpeed: Speed at which the page will scroll upon clicking on the nav. Defaults to 750.
  • scrollThreshold: Percentage of screen at which the next section should become current. Defaults to 0.5.
  • filter: Selector of links to filter out of one page nav functionality.
  • easing: Easing method. Defaults to swing.
  • begin: Function to call when the scrolling starts.
  • end: Function to call when the scrolling ends.
  • scrollChange: Function to call when you enter a section. The current nav item gets passed in.

Click Here to Download....

Monday, 15 December 2014

Dispaly value of one textbox to another textbox using Javascript

 

 Just Copy & Past the Blow Code...


<script>
function copyText2() {
Liberoram = document.getElementById("Liberoram");
copytext= document.getElementById("copytext");
copytext.value = Liberoram.value;
}
</script>

<div>
TextBox 1 : <input type="text" id="Liberoram" onkeyUp="copyText2()"></input>
TextBox 2 : <input type="text" id="copytext"></input>
</div>



Demo
 
TextBox 1 : TextBox 2 :

Friday, 5 September 2014

Update query in php

<div id="contactdiv">

<?php
if(isset($_POST['update']))
{

 $user_mob = $_POST['mob_number'];
$emp_email = "liberoram@gmail.com";

echo $sql = "UPDATE user_register SET mobilenumber ='$user_mob'  where email= '$emp_email'";

$retval = mysql_query( $sql);

echo "Updated data successfully\n";

}
else
{
    echo "Updated data faild\n";
}

?>

<form class="form" action="#" method="post">       
<img src="<?php echo base_url()?>/images/button_cancel.png" class="img" id="cancel"/>
<div class="control-group">
<label for="mob_number" class="control-label">Enter your phone number</label>

<div class="controls">
<input type="text"  name="mob_number" id="mob_number" class="m-wrap medium"  required style="border-radius: 5px !important;  height: 34px !important;"/>

</div></div>
<input type="submit" class="btn theme-btn" name="update"   id="update" value="Update"/>
<input type="button"  class="btn theme-btn"  id="cancel" value="Cancel"/>
<br/>
</form>
</div>

jquery_popup.html


Given below our complete HTML code to create Login and Contact form.


<html>
<head>
<title>jQuery Popup Login and Contact Form</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link rel="stylesheet" href="css/jquery_popup.css" />
<script src="jquery_popup.js"></script>
</head>
<body>
<div id="mainform">
<h2>jQuery Popup Form Example</h2>
<!-- Required Div Starts Here -->
<div class="form" id="popup">
<b>1.Onload Popup Login Form</b><br/><hr/>
<span>Wait for 3 second.Login Popup form Will appears.</span><br/><br/><br/>
<b>2.Onclick Popup Contact Form</b><hr/>
<p id="onclick">Popup</p>
</div>
</div>
<!-- Contact Form -->
<div id="contactdiv">
<form class="form" action="#" id="contact">
<img src="button_cancel.png" class="img" id="cancel"/>
<h3>Contact Form</h3>
<label>Name: <span>*</span></label>
<input type="text" id="name" placeholder="Name"/>
<label>Email: <span>*</span></label>
<input type="text" id="email" placeholder="Email"/>
<label>Contact No: <span>*</span></label>
<input type="text" id="contactno" placeholder="10 digit Mobile no."/>
<label>Message:</label>
<textarea id="message" placeholder="Message......."></textarea>
<input type="button" id="send" value="Send"/>
<input type="button" id="cancel" value="Cancel"/>
<br/>
</form>
</div>
<!--Login Form -->
<div id="logindiv">
<form class="form" action="#" id="login">
<img src="button_cancel.png" class="img" id="cancel"/>
<h3>Login Form</h3>
<label>Username : </label>
<input type="text" id="username" placeholder="Ex -john123"/>
<label>password : </label>
<input type="text" id="password" placeholder="************"/>
<input type="button" id="loginbtn" value="Login"/>
<input type="button" id="cancel" value="Cancel"/>
</form>
</div>
</body>
</html>
 
 

JavaScript File – jquery_popup.js

  • Wait for 3 seconds and jQuery on load event of page allows Login form to popup on exact center of screen.
  • To popup Conact Formuser have to click on “Popup” button.

Saturday, 23 August 2014

PHP mysql_fetch_array() While function

<?php
mysql_connect('localhost', 'root', '');
 mysql_select_db("newcode");
 $q=$_GET["q"];
 $sql="SELECT *  FROM table_name WHERE name_en = '".$q."'";

  $result = mysql_query($sql);

  while($row = mysql_fetch_array($result))
  {
   echo $row['name'];
  }

  mysql_close();
  ?>
 
 

Tuesday, 19 August 2014

join query in PHP



SQL Joins

SQL Joins are used to relate information in different tables. A Join condition is a part of the sql query that retrieves rows from two or more tables. A SQL Join condition is used in the SQL WHERE Clause of select, update, delete statements.

The Syntax for joining two tables is:

SELECT col1, col2, col3...
FROM table_name1, table_name2
WHERE table_name1.col2 = table_name2.col1;

If a sql join condition is omitted or if it is invalid the join operation will result in a Cartesian product. The Cartesian product returns a number of rows equal to the product of all rows in all the tables being joined. For example, if the first table has 20 rows and the second table has 10 rows, the result will be 20 * 10, or 200 rows. This query takes a long time to execute.

Lets use the below two tables to explain the sql join conditions.

database table "product";

product_id product_name supplier_name unit_price
100 Camera Nikon 300
101 Television Onida 100
102 Refrigerator Vediocon 150
103 Ipod Apple 75
104 Mobile Nokia 50

database table "order_items";

order_id product_id total_units customer
5100 104 30 Infosys
5101 102 5 Satyam
5102 103 25 Wipro
5103 101 10 TCS

SQL Joins can be classified into Equi join and Non Equi join.

1) SQL Equi joins

It is a simple sql join condition which uses the equal sign as the comparison operator. Two types of equi joins are SQL Outer join and SQL Inner join.

For example: You can get the information about a customer who purchased a product and the quantity of product.

2) SQL Non equi joins

It is a sql join condition which makes use of some comparison operator other than the equal sign like >, <, >=, <=

1) SQL Equi Joins:

An equi-join is further classified into two categories:
a) SQL Inner Join
b) SQL Outer Join

a) SQL Inner Join:

All the rows returned by the sql query satisfy the sql join condition specified.

For example: If you want to display the product information for each order the query will be as given below. Since you are retrieving the data from two tables, you need to identify the common column between these two tables, which is theproduct_id.

The query for this type of sql joins would be like,

SELECT order_id, product_name, unit_price, supplier_name, total_units
FROM product, order_items
WHERE order_items.product_id = product.product_id;

The columns must be referenced by the table name in the join condition, because product_id is a column in both the tables and needs a way to be identified. This avoids ambiguity in using the columns in the SQL SELECT statement.

The number of join conditions is (n-1), if there are more than two tables joined in a query where 'n' is the number of tables involved. The rule must be true to avoid Cartesian product.

We can also use aliases to reference the column name, then the above query would be like,

SELECT o.order_id, p.product_name, p.unit_price, p.supplier_name, o.total_units
FROM product p, order_items o
WHERE o.product_id = p.product_id;

b) SQL Outer Join:

This sql join condition returns all rows from both tables which satisfy the join condition along with rows which do not satisfy the join condition from one of the tables. The sql outer join operator in Oracle is ( + ) and is used on one side of the join condition only.

The syntax differs for different RDBMS implementation. Few of them represent the join conditions as "sql left outer join", "sql right outer join".

If you want to display all the product data along with order items data, with null values displayed for order items if a product has no order item, the sql query for outer join would be as shown below:

SELECT p.product_id, p.product_name, o.order_id, o.total_units
FROM order_items o, product p
WHERE o.product_id (+) = p.product_id;

The output would be like,

product_id product_name order_id total_units
------------- ------------- ------------- -------------
100 Camera
101 Television 5103 10
102 Refrigerator 5101 5
103 Ipod 5102 25
104 Mobile 5100 30

NOTE:If the (+) operator is used in the left side of the join condition it is equivalent to left outer join. If used on the right side of the join condition it is equivalent to right outer join.

SQL Self Join:

A Self Join is a type of sql join which is used to join a table to itself, particularly when the table has a FOREIGN KEY that references its own PRIMARY KEY. It is necessary to ensure that the join statement defines an alias for both copies of the table to avoid column ambiguity.

The below query is an example of a self join,

SELECT a.sales_person_id, a.name, a.manager_id, b.sales_person_id, b.name
FROM sales_person a, sales_person b
WHERE a.manager_id = b.sales_person_id;

2) SQL Non Equi Join:

A Non Equi Join is a SQL Join whose condition is establis hed using all comparison operators except the equal (=) operator. Like >=, <=, <, >

For example: If you want to find the names of students who are not studying either Economics, the sql query would be like, (lets use student_details table defined earlier.)

SELECT first_name, last_name, subject
FROM student_details
WHERE subject != 'Economics'

The output would be something like,

first_name last_name subject
------------- ------------- -------------
Anajali Bhagwat Maths
Shekar Gowda Maths
Rahul Sharma Science
Stephen Fleming Science

Friday, 15 August 2014

PHP mail() Function

Send an HTML email:

<?php
$to = "somebody@example.com, somebodyelse@example.com";
$subject = "HTML email";

$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>This email contains HTML Tags!</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Libero</td>
<td>Ram</td>
</tr>
</table>
</body>
</html>
";

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// More headers
$headers .= 'From: <Liberoram@example.com>' . "\r\n";
$headers .= 'Cc: liberoram@example.com' . "\r\n";

mail($to,$subject,$message,$headers);
?>

Sunday, 10 August 2014

Contact Us

Libero Ram

Bio:I am Ram, a Web Designer and Developer. I help people make beautiful websites, functional applications and seamless user experiences.

View complete profile

M.S.Ram Kumar 192,Valluvar Colony, Old Natham Road, Madurai.625017..
Phone: +91-9790527572 Email : Liberoram@gmail.com Skype : libero ram