Archive

Archive for January, 2016

January 28, 2016 Leave a comment

http://developerspark.net/2012/09/select-insert-update-and-delete-query-in-zend-framework/

In Zend Framework  It’s very easy to run select, insert, update and delete query,

Select  Query in Zend Framework :

$sql = $this->select()
->from('tablename',array('*'))
->where('userID=?',1);
$data = $this->fetchAll($sql)// This query will return a multidimensional Array.This work as a  mysql_fetch_array()

$data = $this->fetchRow($sql); // Get Row

Insert query in Zend Framework :

Zend  Framework provide the Insert function for insert  the data  :

You can use the Table object to insert rows into the database table on which the Table object is based. Use the insert() method of your Table object.

Create the Object :

   <?php $userTable = new users()?>
<?php

$userProfileData = array(

'first_name'=>'David',
'add_line1'=>'UK',
'description'=>'something'

);

$userTable->insert($userProfileData);

?>

 

Update query in Zend Framework :

Zend  Framework provide the Update  function for update  the data  :

You can use the Table object to update the rows into the database table on which the Table object is based. Use the update() method of your Table object.

Create the Object :

 <?php $userTable = new users()?>

<?php

$userProfileData = array(

'first_name'=>'David',
'add_line1'=>'UK',
'description'=>'something'

);

$userId =2;

$userTable->update($userProfileData,'userID='.$userId);

?>


Delete Query In zend Framework :

You can delete rows from a database table using the delete() method.

Create the Object :

<?php $userTable = new users()?>
<?php

$userId = 2 ;
$userTable->delete('user_id='.$userId); ?>

 



 

Categories: Techanical

Awesome video player to intagrate to your wordpress site

January 28, 2016 Leave a comment
Categories: Techanical

How to login with email only no username in wordpress

January 19, 2016 Leave a comment

It’s possible, you must change the filter for the name.

// remove the default filter
remove_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 );
// add custom filter
add_filter( 'authenticate', 'fb_authenticate_username_password', 20, 3 );
function fb_authenticate_username_password( $user, $username, $password ) {

    // If an email address is entered in the username box, 
    // then look up the matching username and authenticate as per normal, using that.
    if ( ! empty( $username ) )
        $user = get_user_by( 'email', $username );

    if ( isset( $user->user_login, $user ) )
        $username = $user->user_login;

    // using the username found when looking up via email
    return wp_authenticate_username_password( NULL, $username, $password );
}



===============================


http://wordpress.stackexchange.com/questions/51678/how-to-login-with-email-only-no-username