[WP]: PHP SQL - Query Date from Now up to 3 Month Onwards


As per title, here the code. Have a nice day!

<?php 
 
$rows = $wpdb->get_results( 
  "
  SELECT * FROM Table WHERE  
                anydate_col BETWEEN NOW() AND DATE_ADD( NOW() , INTERVAL +3 MONTH)
  "
 );
?>

Thanks.

POSTED BY juong

[Tutorial] - MySQL to JSON Data Using PHP



Encoding JSON in PHP
Some years ago, JSON support was provided through the json pecl extension. Since PHP 5.2, it is included in the core directly, so if you use a recent PHP version you should have no trouble using it.

Note: If you run an older version of PHP than 5.3, I recommend you to upgrade anyway. PHP 5.3 is the oldest version that is currently supported and with the latest PHP security bugs found I would consider it critical to upgrade as soon as possible.

Step 1: Create file with the naming as index.php


<?php 
 
 
$username = 'root';  //database user name variable
$password ='';       //database password
$host ='localhost';

$databasename = 'json-db';

 $conn = mysql_connect($host, $username, $password);
 if (!$conn)
    {
  die('Could not connect: ' . mysql_error());
 }
//select database name and connect 

 mysql_select_db($databasename, $conn);

 
 $sth = mysql_query("Select * from users");
 $rows = array();
 while($r = mysql_fetch_assoc($sth)) {
  $rows[] = $r;
 }
 $json = json_encode($rows);
 echo stripslashes($json); 
?>

Step 2: Retrieve JSON data (callback.php)
There are two ways to call data from another file (index.php), using JQuery or PHP (json_decode).

a. Using JQuery


<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
$(document).ready(function (){
        //using getJSON
 $.getJSON("http://localhost/path-to-your-file/index.php", function(data){ 
    // do stuff with json (in this case an array)
    alert("Success");   
 });
 
 //using Ajax
 $.ajax({
   url:"http://127.0.0.1:8888/json/index.php",
   dataType: 'json', // Notice! JSONP <-- P (lowercase)
   success:function(json){
    // do stuff with json (in this case an array)
    alert("Success");
   },
   error:function(){
    alert("Error");
   },
 });
});
</script>

b. Using PHP json_decode()


<?php
$url = 'http://localhost/path-to-your-file/index.php';
$json = file_get_contents($url);
$datas = json_decode($json);
//var_dump($datas);

foreach($datas as $data){
 echo $data->last_name.'
';
}
?>

credited to: http://nitschinger.at/Handling-JSON-like-a-boss-in-PHP

POSTED BY juong

Introducing to JSON



There are already lots of tutorials out there on handling JSON with PHP, but most of them don't go much deeper than throwing an array against json_encode and hoping for the best. This article aims to be a solid introduction into JSON and how to handle it correctly in combination with PHP. Also, readers who don't use PHP as their programming language can benefit from the first part that acts as a general overview on JSON.

JSON (JavaScript Object Notation) is a data exchange format that is both lightweight and human-readable (like XML, but without the bunch of markup around your actual payload). Its syntax is a subset of the JavaScript language that was standardized in 1999. If you want to find out more, visit the official website.

The cool thing about JSON is that you can handle it natively in JavaScript, so it acts as the perfect glue between server- and client-side application logic. Also, since the syntactical overhead (compared to XML) is very low, you need to transfer less bytes of ther wire. In modern web stacks, JSON has pretty much replaced XML as the de-factor payload format (aside from the Java world I suppose) and client side application frameworks like backbone.js make heavy use of it inside the model layer.

Before we start handling JSON in PHP, we need to take a short look at the JSON specification to understand how it is implemented and what's possible.

Introducing JSON
Since JSON is a subset of the JavaScript language, it shares all of its language constructs with its parent. In JSON, you can store unordered key/value combinations in objects or use arrays to preserve the order of values. This makes it easy to parse and to read, but also has some limitations. Since JSON only defines a small amount of data types, you can't transmit types like dates natively (you can, but you need to transform them into a string or a unix timestamp as an integer).

So, what datatypes does JSON support? It all boils down to strings, numbers, booleans and null. Of course, you can also supply objects or arrays as values.

Tutorial - MySQL to JSON Data Using PHP

Copy&Paste from: http://nitschinger.at/Handling-JSON-like-a-boss-in-PHP

POSTED BY juong

Cara Install Tulisan Jawi | Microsoft Office


Tulisan jawi amat diperlukan terutama bagi guru-guru yang menggunakan tulisan jawi sebagai medium untuk membuat soalan peperiksaan dan kepada mereka yang menggunakan tulisan jawi.

Pada kali ini, aku nak ajar korang cara yang paling mudah untuk install tulisan jawi tanpa sebarang software. Paling penting korang menggunakan Windows tidak kira XP, Vista , Win 7 atau Win 8 .

Sila Abaikan langkah-langkah di bawah jika korang nak convert tulisan jawi ke rumi secara online. [Klik Di Sini]

[ Update 24 Sep 2016 ] - Kini, anda boleh  muaturun apps Rumi ke Jawi di GooglePlay.
Apps ini sangat mudah digunakan. Buat masa sekarang, hanya pengguna android sahaja.













Langkah-langkah install tulisan jawi:
1. Klik start dan klik pada Control Panel.
2. Seterusnya, Klik Region and language.







3. Dibahagian tab, klik Keyboards and Languages.
4. Terdapat dua bahagian yang perlu kita buat ialah klik pada Change Keyboards.






5. Kemudian akan terpapar satu lagi paparan. Anda hanya perlu klik Add dan cari Arabic (Saudi Arabia). Setelah itu, klik ikon “+” pada Keyboards dan Other. Tick pada bahagian yang aku tunjukkan di gambar ini. Kemudian, klik OK.









6. Seterusnya, korang perlu tekan button Apply dan OK.
7. Setelah siap, lihat dibahagian sebelah tray. Klik pada ikon tersebut dan akan terpapar pilihan tulisan. Untuk mengaktifkan penggunaannya, korang perlu klik pada tulisan yang korang mahukan dan terus boleh guna.




Selepas ini, korang boleh mencuba semua jenis tulisan dengan mengikut langkah-langkah yang aku tunjukkan. Kepada yang menggunakan tulisan jawi, selepas ini korang boleh beli sticker khas jawi atau buat sendiri.

P/S: Jika korang mula aktifkan tulisa jawi, kemudian baru korang buka Microsoft Word pastikan korang aktifkan balik tulisan jawi.

99% copy & paste from: http://masterpakpandir.wordpress.com/2011/01/05/cara-mudah-install-tulisan-jawi/#comment-563






POSTED BY juong

Bacaan Dalam Solat: Tahiyat Akhir




[Klik pada gambar untuk besarkan]
Maksud Tahiyat Akhir
 

 


POSTED BY juong

Bacaan Dalam Solat: Tahiyat Awal



[Klik pada gambar untuk besarkan]
Maksud Tahiyat Awal
 
 


POSTED BY juong

Bacaan Dalam Solat: Duduk Antara Dua Sujud


[Klik pada gambar untuk besarkan]
Maksud Duduk Antara Dua Sujud
 
 


POSTED BY juong

Bacaan Dalam Solat: Sujud


[Klik pada gambar untuk besarkan]
Maksud Sujud
 
 


POSTED BY juong

Bacaan Dalam Solat: Iktidal



[Klik pada gambar untuk besarkan]
Maksud Iktidal
 
 


POSTED BY juong

Bacaan Dalam Solat: Rukuk


[Klik pada gambar untuk besarkan]
Maksud Rukuk
 
 


POSTED BY juong

Bacaan Dalam Solat: Iftitah


[Klik pada gambar untuk besarkan]

Maksud Iftitah




POSTED BY juong

Popular Posts

.

Back to Top