Monthly Archives: July 2015

Getting data from database to angular js

Hi all,
Today I would like to explain fetching the data from mysql database using PHP, like we do it in jQuery AJAX. For this first we have to create a PHP file. We can use the following code to fetch a data from database. We already have a database named ‘testingpurpose’ and we get data from ‘branches_list’ table.Here is a simple example of fetch data from front end to mysql database using angularjs.



angular5.php

 $states);
	echo json_encode($json);
	
?>





Now we add our AngularJS script fetch data to front end from mysql database .

  
  
  
  
     
{{ x }}

Thanks for reading.

Insert the data to MYSQL database on PHP page using AngularJS

Hi all,
Today I would like to explain about inserting data to database using PHP, like we do it in jQuery AJAX. For this first we have to create a PHP file. We can use the following code to insert a data to database. We already have a database named ‘testingpurpose’ and we get data from ‘demologin table.Here is a simple example of insert data from front end to mysql database using angularjs.



insertdb.php


  uname);
$upswd = mysqli_real_escape_string($con,$data->pswd);
$uemail = mysqli_real_escape_string($con,$data->email);

$qry_em = 'select count(*) as cnt from demologin where username ="' . $usrname . '"';
$qry_res = mysqli_query($con,$qry_em);
$res = mysqli_fetch_assoc($qry_res);
 
if ($res['cnt'] == 0) {
    $qry = 'INSERT INTO demologin (username,password) values ("' . $usrname . '","' . $upswd . '")';
    $qry_res = mysqli_query($con,$qry);
    if ($qry_res) {
		
        $arr = array('msg' => "User Created Successfully!!!", 'error' => '');
        $jsn = json_encode($arr);
        print_r($jsn);
    } else {
        $arr = array('msg' => "", 'error' => 'Error In inserting record');
        $jsn = json_encode($arr);
        print_r($jsn);
    
} else {
	
   $arr = array('msg' => "", 'error' => 'User Already exists with same email');
   $jsn = json_encode($arr);
   print_r($jsn);
}


?>





Now we add our AngularJS script to insert data from front end to mysql database .


  
  
  
   AngularJs Insert Data to database
   
   


   

Sigup Form Using AngularJS





Thanks for reading.

Mysql Remove Duplicate Data or Rows With DISTINCT

How do I remove duplicate data or rows from a MySQL query?

If output from a MySQL query contains duplicate data or row and if you would like to remove the same use DISTINCT.

DISTINCT combined with ORDER BY needs a temporary table in many cases. Consider following query:
mysql> SELECT firstname FROM registration;




If you need unique firstname i.e remove duplicate contains type the command:
mysql> SELECT DISTINCT firstname FROM registration;

You can use DISTINCT with multiple column as follows:
mysql> SELECT DISTINCT firstname, city FROM registration;

Remove row data angularjs button

Hi Friends..,
I have a table with some sample data. I have a button that I want to use with in the table row that will remove table row when clicked.It will remove the row, the button was clicked in.

This demo shows how to remove/delete a table row dynamically. In coding, AngularJS vey good experence.Happy Coding.






    AngularJS delete operation
    
	 
		
  
  
    

AngularJS Delete Operation

{{customer.id}} {{customer.firstName}} {{customer.lastName}}

…..Happy Coding——

KnockoutJs Basic Idea with Simple Example

Hi Friends,
KnockoutJS is another javascript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying data model.Any time you have sections of User Interface(UI) that update dynamically (e.g:changing depending on the user’s actions), KO can help you implement it more simply and maintainably.



  • Automatically updates the right parts of your UI whenever your data model changes.
  • Pure JavaScript library – works with any server or client-side technology

Simple Example:


 

First name:

Last name:

Hello, !





Calling the ko.applyBindings() method and passing in our view model tells Knockout to bind the specified model to our UI.
JsFiddle Example

Best CSS TextBox Styles

Hi,
A few examples at what can be achieved with CSS and form text box’s. CSS helps different style and effect on text-boxes. Below I have given some text-box styles. You’ll find a style of all coded with just pure CSS3 code.
Try this style in your code..








Style – 1

                         /*Background Color  */
                           .tb1 {
	                       background-color : #99FFCC;
	                       border: 1px solid #008000;
	                       width: 230px;
                               }
                    
Demo Above Style:

Style – 2

                    /* Border Color  */
                    .tb2 {
	                    border: 2px dashed #D1C7AC;
	                    width: 230px;
                       }
              
Demo Above Style:

Style – 3

                    /* Rounded Corner */
                    .tb3 {
	                  border:2px solid #456879;
	                  border-radius:10px;
	                  height: 22px;
	                  width: 230px;
                       }
              
Demo Above Style:

Style – 4

                    /* Double Border */
	                 .tb4 {
	                    border: 3px double #CCCCCC;
	                    width: 230px;
                        }      
              
Demo Above Style:

Difference between Angular Expression and Javascript Expression

AngularJS is a javascript framework. It used for creating single web page applications.JavaScript is a lightweight, interpreted programming language.It is the programming language of HTML and the Web.

Difference Between Angular Expression and Javascript Expression

  • Context:In AngularJS, the expressions are evaluated against a scope object.In Javascript expressions, are evaluated against the global window



  • Forgiving: In Angular expression, is forgiving to nulland undefined. In Javascript undefined properties generates TypeError or ReferenceError

Marquee in HTML

We are discuss different Marquee style scroll in different manner. Such as top to bottomm, bottom to top, left to right, right to left and scroll speed control.
Marquee tag is used for the purpose of make the small kind of head line or make important thing in the particular area using marquee scroll style.
Marquee tags are used more purpose,like latest news, top news publishing, events etc all things are scroll in a particular area.



demo

START/STOP


Start and stop are the main functions in marquee.

		
		
	





onmouseover=”this.stop();” for stop the marquee content on on mouse over
onmouseout=”this.start();” for start the marquee tag content on mouse out.

MARQUEE DIRECTION


Marquee direction is used for make the marquee move direction.

		
		
	
	





Choose any one direction in the above direction like left or right or up or down any one direction.

MARQUEE SPEED


Marquee speed specify how reduce and increase the speed of marquee tag moving.

		
		
	




FULL CODE




Bottom to top

  • Bottam to top
  • Test

Top to bottom

  • top to bottom
  • Test

Left to right

  • Left to right
  • Test

Right to left

  • right to left
  • Test




download

WordPress Form Plugin with ShortCode

Hi all,
I am going to explain you how easily you can create your own shortcode using one simple examples.
Shortcode function to create shortcode in WordPress plugin. For using shortcode function, you have to define a handler function that parse the shortcode and return some output.
Then, you need to register a shortcode using add_shortcode() function.




add_shortcode( $shortcode_name, $handler_function); You can create shortcode to display form on any page or post of the website.

<?php
/*
* Plugin Name: WordPress plugin-shotrcode
* Description: Create your WordPress shortcode.
* Version: 1.0
* Author: Pritty
* Author URI: http://prittytimes.com
*/
function form_creation()
{
?>
<form>
First name: <input type=”text” name=”firstname”>
Code Details:
form_creation()- to create a form which includes form fields.
add_shortcode()- function which contain shortcode name test and calling of form_creation() function as parameters.




You need to place WordPress shortcode within square brackets in order to represent it on any page or post of the website.Code word test enclosed within square brackets like [test].