Monday, April 20, 2015

set flash data in codeigniter

first go to your controller: e.g mycontroller.php and think this is a method your form will post into it:
------------------------------------------------
public function submitData(){
        $my_input = $this->input->post('form_input_name');

        /******insert these data to database************/
 $insertJournalDrData = array(
                "field_name" => $my_input
                 );
    $ledger_id=$this->Model->isnertData('tableName',$insertData);
      /********end of insertion in database***********/
        $this->session->set_flashdata('success_message','Data Saved Successfully!');
        redirect('mycontroller');
    }

secondly, your view will be like this:
--------------------------------------------------
<?php if ($this->session->flashdata('success_message') != ''):?>
      <div class="alert alert-success" role="alert">
             <?php echo $this->session->flashdata('success_message');?>
       </div>
<?php endif;?>

Note: here database is not important, you can do it without database.

Monday, April 6, 2015

code for everyday notification for android

in your main activity type down the below code:
-------------------------------------------------------------------------------------------------
/*this notification will come everyday night at 8PM*/
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 20);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
Intent intent1 = new Intent(this, NotifyByBraodCast.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(
this, 0, intent1,
PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager am = (AlarmManager) this
.getSystemService(this.ALARM_SERVICE);
am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
AlarmManager.INTERVAL_DAY, pendingIntent);
---------------------------------------------------------------------------------------------------
make a class name : NotifyByBraodCast and type down the below code:
---------------------------------------------------------------------------------------------------
public class NotifyByBraodCast extends BroadcastReceiver {

NotificationManager nm;

@Override
public void onReceive(Context context, Intent intent) {
nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
CharSequence from = "Title";
CharSequence message = "Description!";
Intent notificationIntent = new Intent(context, splash.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
Notification notification = new Notification(android.R.drawable.ic_media_play, "Let's Play!", System.currentTimeMillis());
notification.setLatestEventInfo(context, from, message, contentIntent);
notification.flags = Notification.DEFAULT_LIGHTS | Notification.FLAG_AUTO_CANCEL;
nm.notify(1, notification);
}
}

Intersect or Minus mysql query

Follow the below query for two table minus query:



SELECT field1,field2 FROM tableA

WHERE field1 NOT IN ( SELECT field1 FROM tableB)

Friday, March 27, 2015

Html form tabindex enter press control by Jquery

Html form tabindex control by Jquery, follow below code: 
*note: this below code actually a hint, programmers can understand how to use it:

<form id="form1" name="form1" action="saver.php" method="post">
        <label>Name:</label>
        <input name="name" value="" tabindex="1">
        <label>Roll:</label>
        <input name="roll" value="" tabindex="2">
        <label>Address:</label>
        <input name="address" value="" tabindex="3">
        <label>Phone:</label>
        <input name="phone" value="" tabindex="4">
        <label>Email:</label>
        <input name="email" value="" tabindex="5">
        <input type="submit" tabindex="6">

    </form>
----------------------------------------------------------------------------------------------
<script>
    $(document).ready(function () {
        $("#form1 input:first").focus();
        $('#form1').on('keydown', 'input', function (event) {
            if (event.which == 13) {            
                var $this = $(event.target);
                var index = parseFloat($this.attr('tabindex'));
                $('[tabindex="' + (index + 1).toString() + '"]').focus();
                if (index == 6) {
                    return true;
                }
                return false;
            }
        });
    });
</script>

Wednesday, March 18, 2015

raw query plan to get woocommerce order by specific user


First go to postmeta table with user id then you will get order id as post id then with those post id go to order_itemmeta table to get order details in row then with that order_itemmeta table you will get order_item_id with meta value, this meta value is your product id you can now get that product info by that product id in posts table now make a join query to get all those thing in one table :) Good luck!

Wednesday, January 28, 2015

Redirecting page by js

<a href="http://ashique12009.files.wordpress.com/2011/06/js.jpg"><img src="http://ashique12009.files.wordpress.com/2011/06/js.jpg" alt="" title="js" width="157" height="127" class="alignnone size-full wp-image-24" /></a>
<strong>this works fine for every browser</strong>
<strong>window.location.href='url';</strong>

PHP 1 page solution...

you can use hidden variable to post something on same page without not going to another page...i'll show you later...

Workflow of WordPress project in a team with Git

1. We should not push any Wordpress core folders or files to github. 2. Only push custom theme and custom plugin into github. 3. So, in this...