TERGEMPARRR !!! Untuk pertama kalinya setelah ratusan tahun, Salji turun di Vietnam hari ini....!!!



TERGEMPARRR !!! Untuk pertama kalinya setelah ratusan tahun, Salji turun di Vietnam hari ini....!!! 

Dilaporkan, beberapa daerah di Laos, Vietnam dan juga Selatan China telah mula dibasahi hujan salji. Beberapa lokasi di sekitar Provinsi Lao-Chai dan Ha Giang, Vietnam telah dipenuhi salji tebal. 

Ia telah mengakibatkan kesesakan lalulintas kerana rakyat tidak menyangka bahawa salji akan turun disitu pada tahun ini. Masihkah kita ingat tentang Hadis Baginda Nabi SAWAW yang telah diriwayatkan oleh banyak rawi? Mafhumnya... "Akan datang kepada kalian kelak satu kaum yang mana di dalam kaum itu ada seorang pemimpin bergelar Al-Mahdi.

Sesungguhnya tatkala kalian mendengarkannya, wajiblah datang kepadanya walaupun terpaksa merangkak di atas salji." Hadis Hasan dengan rawi mutawatir.

Apakah tidak lama lagi Malaysia juga akan merasai nikmat (atau bala? peringatan?) salji ini?? Adakah salji juga akan turun di negara kita dan Indonesia tak lama lagi?? Jika ya, maka ketahuilah.... mungkin-mungkin itu petanda datangnya Al-Mahdi buat zaman ini. 

Allahumma Amiin... Labbaika Ya Mahdi....  Sebarkan info ini nescaya ia bermanfaat buat semua umat Islam !

CARA UNLOCK MODEM CELCOM MAXIS DIGI





How to unlock modem?

Online Unlock Key Generator

1. Go to this site.


2. Select your modem Huawei/ZTE
3. Insert modem IMEI number. Then, Click Calculator.

IMEI NUMBER 

4. Save the Unlock code number and Flash code
5. Insert your new sim (another sim that want to use) into modem and plug to your PC/Laptop.


Then Just enter the unlock code you have received earlier into the pop-up .

6. Enjoy your new internet provider.

Cara menggunakan PowerPoint 2010 Transisi untuk efek maksimum

PowerPoint 2010 memiliki berbagai fitur canggih yang dapat digunakan untuk membuat presentasi lebih profesional, lebih menarik dan dinamis. Satu set besar slide PowerPoint dapat menambahkan bahwa sesuatu yang ekstra untuk presentasi Anda yang bisa menutup penjualan, terkesan dukungan manajer atau keuntungan untuk proyek hewan peliharaan. Salah satu cara untuk meningkatkan presentasi Anda adalah dengan menambahkan transisi antara slide.


Satu hal penting yang perlu diperhatikan sebelum Anda mulai. Transisi ada untuk membantu Anda lebih baik menyajikan pesan yang Anda miliki untuk penonton. Bila Anda memilih transisi, cobalah untuk tetap sederhana dan tidak menggunakan lebih dari dua transisi seluruh presentasi. Salah satu transisi untuk sebagian besar slide Anda dan yang kedua untuk setiap slide yang memerlukan penekanan khusus, jika tidak memerlukan penekanan khusus kemudian tetap menggunakan hanya satu transisi. Mari kita lihat bagaimana untuk menambahkan transisi.

Menambahkan Transisi
Sebelum Anda mulai menambahkan transisi, Anda perlu menentukan transisi sesuai dengan gaya Anda dan pesan Anda mencoba untuk memberikan. Setelah Anda melakukan ini, pilih slide pertama yang Anda ingin menerapkan transisi dan kemudian klik pada tab Transitions.



Secara default, tab Transisi akan menampilkan transisi yang paling umum digunakan. Pilih transisi yang Anda ingin menerapkan ke slide Anda, jika ini tidak sesuai dengan tujuan Anda, Anda dapat melihat galeri efek transisi dengan mengklik pada tombol More, yang merupakan panah kecil ditampilkan dalam warna ungu pada gambar di atas. Galeri transisi dipisahkan menjadi tiga kategori, SubtleExciting, dan Dynamic Content.


 Dari tiga kategori, transisi Dynamic Content adalah efek transisi baru di PowerPoint 2010 dan PowerPoint 2011 untuk Mac Apple. Perbedaan antara transisi Konten Dinamis dan kategori Subtle dan Exciting adalah bahwa transisi Dynamic Content terjadi hanya pada isi slide tidak pada setiap latar belakang.
Lakukan percobaan dengan pilihan untuk arah dan waktu karena beberapa presentasi tampak hebat dapat dibuat dengan menggunakan transisi Dynamic Content - namun mereka tidak akan bekerja dengan baik pada slide yang tidak memiliki judul latar belakang dan warna apapun.
Tip: Ingatlah bahwa Anda dapat melihat transisi dengan Live Preview atau hover mouse Anda ke setiap item dalam galeri.

Tergantung pada transisi yang dipilih, Anda mungkin dapat menggunakan Effect Optionsuntuk mengubah cara di mana transisi bekerja. Efek yang tersedia akan bervariasi dari tidak ada efek ke delapan efek yang berbeda tergantung pada transisi yang Anda pilih.


Transition Timing Group
Pada pita Transition, Anda akan melihat sebuah kelompok ke kanan disebut kelompokTiming. Kelompok ini berisi kumpulan tombol perintah yang melakukan lebih dari sekedar mengontrol kapan dan berapa lama transisi akan mengambil.

Meskipun pilihan waktu tidak selalu diperlukan, seperti waktu untuk animasi, pengaturan dapat membantu presenter tetap dalam waktu berbicara yang diberikan mereka. Kelompok Timing berisi tombol untuk suara, Durasi, Terapkan untuk Semua, dan Slide Advance. Mari kita lihat pilihan yang tersedia dan bagaimana mereka dapat meningkatkan presentasi.

Meskipun tidak sering digunakan, suara dapat ditambahkan ketika satu slide transisi yang lain. Suara yang dipilih bisa menjadi sinyal pendengaran besar untuk seorang presenter untuk bergerak dan mulai berbicara tentang item dalam slide berikutnya, terutama jika dia / dia tidak melihat presentasi. Suara dapat ditambahkan ke transisi dengan memilih salah satu opsi dari menu drop down menu Sound.



Tip: Jika Anda tidak merasa salah satu PowerPoint suara terdaftar sesuai, Anda dapat menggunakan suara lain pada hard disk Anda, dengan mengklik pilihan suara lainnya di dekat bagian bawah daftar suara.

Tombol Duration memungkinkan Anda untuk menentukan berapa lama transisi akan mengambil. Biasanya waktu default adalah lebih dari cukup. Jika Anda ingin mengubah waktunya mencoba untuk tidak menerapkan lebih dari dua detik. Misalnya, berdurasi sepuluh detik untuk transisi akan sangat membosankan untuk menonton.


Switch Advance Slide memungkinkan Anda untuk menentukan kapan dan bagaimana satu slide akan transisi ke yang berikutnya. On Mouse Click, yang merupakan pilihan default, memungkinkan presenter untuk beralih ke slide berikutnya dengan mengklik mouse mereka. Tombol After akan memunculkan slide berikutnya setelah durasi tertentu.


Tip: Kecuali waktu presentasi yang ketat atau Anda membuat presentasi slide otomatis, yang terbaik adalah meninggalkan default On Mouse Click. Hal ini memungkinkan presenter untuk menerima dan menangani pertanyaan penonton tanpa dipaksa buru-buru ke slide berikutnya atau harus kembali ke slide sebelumnya.

Opsi terakhir dalam kelompok Timing adalah tombol Apply to All. Tombol ini adalah penghemat waktu yang tepat karena memungkinkan Anda untuk menyalin semua pilihan transisi dibuat pada slide untuk setiap slide lainnya di dek. Untuk presentasi dengan empat atau lima slide ini mungkin tidak terdengar seperti masalah besar, namun jika Anda memiliki dua puluh atau lebih slide, mencoba untuk mengatur transisi pada setiap slide dapat menjadi tugas nyata. Selain itu, tombol Apply to All memungkinkan Anda untuk memastikan bahwa dek geser seluruh konsisten.

Tips untuk Menggunakan Transisi
Jika Anda menggunakan tombol Apply to All, Anda masih bisa mengubah slide individu sesudahnya.

Itu selalu layak menggunakan tombol Transition Preview setiap kali perubahan dibuat untuk transisi, misalnya ketika efek khusus yang dibuat untuk transisi, transisi suara ditambahkan atau waktu otomatis diatur - hanya untuk memeriksa bahwa transisi bekerja dengan cara membantu untuk kedua penonton dan presenter.

Transisi membantu memberikan kehidupan dan mengalir ke PowerPoint, namun hindari penggunaan transisi yang berbeda terlalu banyak dalam satu presentasi. Stick dengan salah satu jenis transisi atau paling banyak dua transisi, jika presentasi akan terlihat berantakan dan tidak profesional.

Jika Anda menggunakan dua jenis transisi yang berbeda, gunakan salah satu transisi untuk slide deck utama dan transisi kedua untuk menempatkan penekanan ekstra pada konten penting atau kunci.

Powerpoint 2010 adalah alat yang ampuh untuk meningkatkan kejelasan, gaya dan profesionalisme presentasi Anda. Hanya membutuhkan waktu beberapa klik untuk menambah energi dan semangat untuk presentasi jika kering.

Simple Alarm Clock using Visual Basic.Net

In this tutorial, we're going to create a simple alarm clock. This alarm clock can be used to wake a person in at a specific time. To start with this application, open visual basic and create a new project and name it as “Alarm Clock”. The application when finished, it looks like as shown below.
Next, add five labels,and name the label1 as “lblcurtime” and label2 as “lblstatus” then,set the text property of the other label as “Current Time”, “Alarm Time” and “Message”. Add a Datetimpicker, then set it into “Time” format. Then add a textbox and a Button, after this rename the textbox1 as “txtmsg” and the button1 as “btnsetalarm”. And lastly add two timer.
This time, we will add functionality to our application. First double click the “timer1” and add the following code:
This code will simply check if the current settings of DateTimePicker1 match the Time of the day and the time is based on your local machine. So if match, it performs the following statements.
  1. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  2. If TimeOfDay = DateTimePicker1.Text Then
  3. 'This will instantinize a new "voice" for this app to speak through
  4. Dim voice = CreateObject("SAPI.spvoice")
  5. 'what the content of txtmsg will be passed to voice.speak
  6.  
  7. voice.speak(TextBox1.Text)
  8. lblstatus.Text = "Status:Alarm is not set!"
  9. End If
  10.  
  11. End Sub
Then, double click the “timer2” and add the following code:
This will display the current time based on the local machine.
  1. lblcurtime.Text = TimeOfDay
Next on the “form1_load” add the following code:
  1. Timer2.Enabled = True
And finally on the “btnsetalarm” button add the following code:
It enables the timer1 and set the alarm clock.

Timer1.Enabled = True
lblstatus.Text = "Status:Alarm is set!"
This time you can now try testing your program by pressing “F5”.

The Hobbit 2: The Desolation of Smaug (2013) TS



The Hobbit: The Desolation of Smaug Movie Poster
GetMediafire Information Image

Movie Info

IMDB:The Hobbit: The Desolation of Smaug 2013
[Format]…………..[ TS
[Genre]……………[ Adventure, Drama, Fantasy
[Cast]…………….[ Martin Freeman, Ian McKellen, Richard Armitage, Benedict Cumberbatch
[Writer]:………….[ Fran Walsh, Philippa Boyens
[Director]:………..[ Peter Jackson
[Size]…………….[ 875MB
[Duration]…………[ N/A
[Search Subtitles]….[ Subscene.com
[Source]…………..[ TS
[iMDB Rating]………[ N/A

Video Info

Size: 911604244 bytes (869.37 MiB), duration: 02:29:06, avg.bitrate: 815 kb/s
Audio: ac3, 44100 Hz, 2 channels, s16
Video: mpeg4, yuv420p, 608×320, 23.98 fps(r)

Story

The dwarves, along with Bilbo Baggins and Gandalf the Grey, continue their quest to reclaim Erebor, their homeland, from Smaug. Bilbo Baggins is in possession of a mysterious and magical ring.




GetMediafire ScreenShot Image
The Hobbit: The Desolation of Smaug screen 1



GetMediafire Dowload Button


OnlineVNC: Remotely access your computer on the browser

OnlineVNC is a service that allows you to remotely control a computer using a web browser running on any operating sytem, wherever you are, work, hotels, etc. The service can also be used tor provide online IT support, the only thing needed for it to work is installing the Windows only software on the server side and that Adobe Flash is present on the client side. The application can also grant access to your home computer to friends or work colleages to share huge files with the built-in FTP client or show presentations.

The server control panel allows you to see who is connected and what they are doing in real time, being able to restrict or give viewing, keyboard or mouse access. There is no limit to the number of people who can connect to the computer, communication takes place using the Remote Framebuffer (RFB)  protocol, compatible with offline Virtual Network Computing viewers like TightVNC, RealVNC and UltraVNC, you can log off or lock the remote computer without breaking the connection, the remote desktop picture can be scaled, with a fit to screen mode and the network speed can be changed to slow, reducing the quality of graphics optimizing bandwidth in slow networks.
Remote desktop access OnlineVPN
Remote desktop access OnlineVPN
The connection port number can be configured, this should help getting around firewalls and making your server harder to spot on the Internet by adopting a non usual port, if you notice anyone scanning your computer adding their IP to the Host Filter will blacklist it.
There are trust based downsides to this uncomplicated solution for remote computer access, if you are not using your own computer it would be a security risk accessing OnlineVNC because you have no guarantee against keyloggers in an Internet cafe, but with your own tablet or laptop it is not a problem. Another downside is that the RFB protocol is not very secure and it is possible to crack the password if someone on the network captures the encryption key, but you can tunnel OnlineVNC over a VPN adding an extra security layer with strong encryption, a third downside is that you have to trust the company managing the service to respect your privacy and be responsable, beyond that, OnlineVNC is acceptable for those looking for an effortless way to remotely access computer files.

Create your own Virtual Private Network with NeoRouter

Neorouter is a free application designed to remotely connect to other computers securely with just a couple of clicks and little configuration, it can be used to help a friend or family member troubleshoot computer problems giving you remote access to their machine or you can use it to connect to your home server or computer from work, to save in electrical bills the home computer can be left on standby and Neorouter will instruct it to wake up when you connect for the first time.
This VPN software allows you to bypass corporate firewalls that block P2P traffic, similar applications (e.g. Hamachi) get around firewalls routing traffic through a central server that can be at times slow depending on the number of users, Neorouter improves VPN speed relaying traffic through your router instead of a central server, it can be set up to use an HTTP or socks4/5 proxy server if necessary.
Private VPN network NeoRouter
Private VPN network NeoRouter
The application is available for Windows, Mac, Linux, FreeBSD and Android, consisting of a client and a server that will work as a central hub creating a virtual LAN, the server can be set up on any router using open source firmware, like OpenWRT and Tomano. There is no limit to how many computers can be networked with this application creating a P2P friends only network where to share files, play games and communicate with each other in private, the connection will always be encrypted. Capabilities can be expanded with its built-in add-ons including VNC client, Telnet/SSH and SFTP, there is also a built-in firewall.
Travellers will be happy to know that you can download a portable Neorouter VPN client that can be run from within a USB thumbdrive and does not need administrator rights.

Create your own home VPN network with Comodo Unite

Comodo Unite is a secure virtual private network (VPN) that can associate an unlimited number of computers,  connected PCs can talk in between them and exchange data, all that is needed is that they have the software installed, it can be used to access your home computer from work and retrieve or send files. The system could be compared to a form of private messenger where communications are encrypted and only those with an invitation can join the network with the added advantage of being able to control remote computers if enough rights are given. Software like Comodo Unite is ideal to help others troubleshoot computer problems over the Internet, it will allow you to remotely control their desktop, including applications and Internet browser, with just a couple of clicks.
When you create a network, unless it has been marked as public, membership requests will need to be approved, or if the other end has been given a password, he can automatically join the private network after which he can be assigned administrator rights. Comodo Unite can also communicate with 3rd party IM programs like Windows Messenger, Google Talk, Yahoo Messenger, ICQ and Facebook chat, Comodo Unite imports the settings of your already installed favourite Instant Messenger program and allows you to chat as you normally would do without having to swap client.
Comodo Unite home VPN network
Comodo Unite home VPN network
Home virtual private networks can be of use if you travel abroad and do not want to take certain files with you, however something VPN software can not do is to switch on the remote computer, you will have leave the computer booted up at all times. Remote authentication is made using a password, digital certificate or both. A web based interface allows administrators to manage a Unite network from any computer with Internet access.
Communications take place P2P with no central server logs, but make no mistake, this is not an anonymity tool, it will keep a third party from spying on your encrypted chat sessions and data transfers, but the other end will know your computer IP at all times and they will also know the computer you are connecting to. The software is free for non commercial use and it has a very complete easy to understand online help manual with screenshots.

PHP Database Access: Are You Doing It Correctly?

What?

It's possible that, at this point, the only thought in your mind is, "What the heck is PDO?" Well, it's one of PHP's three available APIs for connecting to a MySQL database. "Three," you say? Yes; many folks don't know it, but there are three different APIs for connecting:
  • mysql
  • mysqli – MySQL Improved
  • pdo – PHP Data Objects
The traditional mysql API certainly gets the job done, and has become so popular largely due to the fact that it makes the process of retrieving some records from a database as easy as possible. For example:
/*
 * Anti-Pattern
 */

# Connect
mysql_connect('localhost', 'username', 'password') or die('Could not connect: ' . mysql_error());

# Choose a database
mysql_select_db('someDatabase') or die('Could not select database');

# Perform database query
$query = "SELECT * from someTable";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

# Filter through rows and echo desired information
while ($row = mysql_fetch_object($result)) {
    echo $row->name;
}
Yes, the code above is fairly simple, but it does come with its significant share of downsides.
  • Deprecated: Though it hasn't been officially deprecated – due to widespread use – in terms of best practice and education, it might as well be.
  • Escaping: The process of escaping user input is left to the developer – many of which don't understand or know how to sanitize the data.
  • Flexibility: The API isn't flexible; the code above is tailor-made for working with a MySQL database. What if you switch?
PDO, or PHP Data Objects, provides a more powerful API that doesn't care about the driver you use; it's database agnostic. Further, it offers the ability to use prepared statements, virtually eliminating any worry of SQL injection.

How?

When I was first learning about the PDO API, I must admit that it was slightly intimidating. This wasn't because the API was overly complicated (it's not) – it's just that the old myqsl API was so dang easy to use!
Don't worry, though; follow these simple steps, and you'll be up and running in no time.

Connect

So you already know the legacy way of connecting to a MySQL database:
# Connect
mysql_connect('localhost', 'username', 'password') or die('Could not connect: ' . mysql_error());
With PDO, we create a new instance of the class, and specify the driver, database name, username, and password – like so:
$conn = new PDO('mysql:host=localhost;dbname=myDatabase', $username, $password);
Don't let that long string confuse you; it's really very simple: we specify the name of the driver (mysql, in this case), followed by the required details (connection string) for connecting to it.
What's nice about this approach is that, if we instead wish to use a sqlite database, we simply update the DSN, or "Data Source Name," accordingly; we're not dependent upon MySQL in the way that we are when use functions, like mysql_connect.

Errors

But, what if there's an error, and we can't connect to the database? Well, let's wrap everything within a try/catch block:
try {
    $conn = new PDO('mysql:host=localhost;dbname=myDatabase', $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
    echo 'ERROR: ' . $e->getMessage();
}
That's better! Please note that, by default, the default error mode for PDO is PDO::ERRMODE_SILENT. With this setting left unchanged, you'll need to manually fetch errors, after performing a query.
echo $conn->errorCode();
echo $conn->errorInfo();
Instead, a better choice, during development, is to update this setting to PDO::ERRMODE_EXCEPTION, which will fire exceptions as they occur. This way, any uncaught exceptions will halt the script.
For reference, the available options are:
  • PDO::ERRMODE_SILENT
  • PDO::ERRMODE_WARNING
  • PDO::ERRMODE_EXCEPTION

Fetch

At this point, we've created a connection to the database; let's fetch some information from it. There's two core ways to accomplish this task: query and execute. We'll review both.

Query

/*
 * The Query Method
 * Anti-Pattern
 */

$name = 'Joe'; # user-supplied data

try {
    $conn = new PDO('mysql:host=localhost;dbname=myDatabase', $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    $data = $conn->query('SELECT * FROM myTable WHERE name = ' . $conn->quote($name));

    foreach($data as $row) {
        print_r($row); 
    }
} catch(PDOException $e) {
    echo 'ERROR: ' . $e->getMessage();
}
Though this works, notice that we're still manually escaping the user's data with the PDO::quote method. Think of this method as, more or less, the PDO equivalent to use mysql_real_escape_string; it will both escape and quote the string that you pass to it. In situations, when you're binding user-supplied data to a SQL query, it's strongly advised that you instead use prepared statements. That said, if your SQL queries are not dependent upon form data, the query method is a helpful choice, and makes the process of looping through the results as easy as a foreach statement.

Prepared Statements

/*
 * The Prepared Statements Method
 * Best Practice
 */

$id = 5;
try {
    $conn = new PDO('mysql:host=localhost;dbname=myDatabase', $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);    
    
    $stmt = $conn->prepare('SELECT * FROM myTable WHERE id = :id');
    $stmt->execute(array('id' => $id));

    while($row = $stmt->fetch()) {
        print_r($row);
    }
} catch(PDOException $e) {
    echo 'ERROR: ' . $e->getMessage();
}
In this example, we're using the prepare method to, literally, prepare the query, before the user's data has been attached. With this technique, SQL injection is virtually impossible, because the data doesn't ever get inserted into the SQL query, itself. Notice that, instead, we use named parameters (:id) to specify placeholders.
Alternatively, you could use ? parameters, however, it makes for a less-readable experience. Stick with named parameters.
Next, we execute the query, while passing an array, which contains the data that should be bound to those placeholders.
$stmt->execute(array('id' => $id));
An alternate, but perfectly acceptable, approach would be to use the bindParam method, like so:
$stmt->bindParam(':id', $id, PDO::PARAM_INT);
$stmt->execute();

Specifying the Ouput

After calling the execute method, there are a variety of different ways to receive the data: an array (the default), an object, etc. In the example above, the default response is used: PDO::FETCH_ASSOC; this can easily be overridden, though, if necessary:
while($row = $stmt->fetch(PDO::FETCH_OBJ)) {
    print_r($row);
}
Now, we've specified that we want to interact with the result set in a more object-oriented fashion. Available choices include, but not limited to:
  • PDO::FETCH_ASSOC: Returns an array.
  • PDO::FETCH_BOTH: Returns an array, indexed by both column-name, and 0-indexed.
  • PDO::FETCH_BOUND: Returns TRUE and assigns the values of the columns in your result set to the PHP variables to which they were bound.
  • PDO::FETCH_CLASS: Returns a new instance of the specified class.
  • PDO::FETCH_OBJ: Returns an anonymous object, with property names that correspond to the columns.
One problem with the code above is that we aren't providing any feedback, if no results are returned. Let's fix that:
$stmt->execute(array('id' => $id));

# Get array containing all of the result rows
$result = $stmt->fetchAll();

# If one or more rows were returned...
if ( count($result) ) {
    foreach($result as $row) {
        print_r($row);
    }
} else {
    echo "No rows returned.";
}
At this point, our full code should look like so:
 
  $id = 5;
  try {
    $conn = new PDO('mysql:host=localhost;dbname=someDatabase', $username, $password);
    $stmt = $conn->prepare('SELECT * FROM myTable WHERE id = :id');
    $stmt->execute(array('id' => $id));

    $result = $stmt->fetchAll();

    if ( count($result) ) { 
      foreach($result as $row) {
        print_r($row);
      }   
    } else {
      echo "No rows returned.";
    }
  } catch(PDOException $e) {
      echo 'ERROR: ' . $e->getMessage();
  }

Multiple Executions

The PDO extension becomes particularly powerful when executing the same SQL query multiple times, but with different parameters.
try {
  $conn = new PDO('mysql:host=localhost;dbname=someDatabase', $username, $password);
  $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  # Prepare the query ONCE
  $stmt = $conn->prepare('INSERT INTO someTable VALUES(:name)');
  $stmt->bindParam(':name', $name);

  # First insertion
  $name = 'Keith';
  $stmt->execute();

  # Second insertion
  $name = 'Steven';
  $stmt->execute();
} catch(PDOException $e) {
  echo $e->getMessage();
}
Once the query has been prepared, it can be executed multiple times, with different parameters. The code above will insert two rows into the database: one with a name of “Kevin,” and the other, “Steven.”

CRUD

Now that you have the basic process in place, let’s quickly review the various CRUD tasks. As you’ll find, the required code for each is virtually identical.

Create (Insert)

try {
  $pdo = new PDO('mysql:host=localhost;dbname=someDatabase', $username, $password);
  $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  $stmt = $pdo->prepare('INSERT INTO someTable VALUES(:name)');
  $stmt->execute(array(
    ':name' => 'Justin Bieber'
  ));

  # Affected Rows?
  echo $stmt->rowCount(); // 1
} catch(PDOException $e) {
  echo 'Error: ' . $e->getMessage();

Update

$id = 5;
$name = "Joe the Plumber";

try {
  $pdo = new PDO('mysql:host=localhost;dbname=someDatabase', $username, $password);
  $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  $stmt = $pdo->prepare('UPDATE someTable SET name = :name WHERE id = :id');
  $stmt->execute(array(
    ':id'   => $id,
    ':name' => $name
  ));
  
  echo $stmt->rowCount(); // 1
} catch(PDOException $e) {
  echo 'Error: ' . $e->getMessage();
}

Delete

$id = 5; // From a form or something similar

try {
  $pdo = new PDO('mysql:host=localhost;dbname=someDatabase', $username, $password);
  $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  $stmt = $pdo->prepare('DELETE FROM someTable WHERE id = :id');
  $stmt->bindParam(':id', $id); // this time, we'll use the bindParam method
  $stmt->execute();
  
  echo $stmt->rowCount(); // 1
} catch(PDOException $e) {
  echo 'Error: ' . $e->getMessage();
}

Object Mapping

One of the neatest aspects of PDO (mysqli, as well) is that it gives us the ability to map the query results to a class instance, or object. Here’s an example:
class User {
  public $first_name;
  public $last_name;

  public function full_name()
  {
    return $this->first_name . ' ' . $this->last_name;
  }
}

try {
  $pdo = new PDO('mysql:host=localhost;dbname=someDatabase', $username, $password);
  $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  $result = $pdo->query('SELECT * FROM someTable');

  # Map results to object
  $result->setFetchMode(PDO::FETCH_CLASS, 'User');

  while($user = $result->fetch()) {
    # Call our custom full_name method
    echo $user->full_name();
  }
} catch(PDOException $e) {
  echo 'Error: ' . $e->getMessage();
}