Create Function SQL Query With Unlimited Columns and Value in PHP

9/23/2016 07:15:00 AM Add Comment
Create Function SQL Query With Unlimited Columns and Value in PHP

Let's do It, I create something awesome to help your project with native PHP , i create this function cause me not learn framework but i think can applicated a Framework function in native PHP, that a code of function.

<?php 
function unlimited_insert($tabel,$kolom,$value)
{
    $total_kolom = count($kolom);
    $total_value = count($value);
 
 $query = "INSERT INTO ".$tabel;
 $query .= " (";
 for($counter_kolom = 0;$counter_kolom <= $total_kolom-1;$counter_kolom++)
 {
  $query .=$kolom[$counter_kolom];
        if($counter_kolom != count($kolom)-1)
        {
            $query .=",";
        }
 }
 $query .= ")";
    if($total_value != 0)
    {
        $query .= " VALUES (";
    }else{
        $query .= " VALUE (";
    }
    for($counter_value = 0;$counter_value <= $total_value-1;$counter_value++)
 {
        
  $query .=$value[$counter_value];
        if($counter_value != count($value)-1)
        {
            $query .=",";
        }
 }
    $query .=")";
    return $query;
}

$array_kolom = array("si","a","b");
$array_value = array("su","su","jablay");
echo unlimited("Table",$array_kolom,$array_value);
?>

Usage Of This Function :

unlimited(table,array_your_columns,array_your_value);

Benefit usage this function, you can add mysqli_escape_real_string, without manual setting in all your query, and you no need add many function for diferent query, this code can use for INSERT, DELETE,UPDATE simply CRUD query with 3 function in your library. 

How To Fix Error : following error has occured: No suitable driver found for jdbc:mysql://localhost/dbname in Java

9/21/2016 03:28:00 PM Add Comment
Cara memberbaiki error : following error has occured: No suitable driver found for jdbc:mysql://localhost/dbname di Java

This is Simple Solution about your problem, when you run the program the library mysql in folder lib, not found, like as you copy only the file.jar in to another directory, BUT the folder lib  in file.jar directory not copied and that can make error.

The solution, you copy the folder lib and paste in same directory with your file.jar.

======
Cara memberbaiki error : following error has occured: No suitable driver found for jdbc:mysql://localhost/dbname di Java

Solusinya simple, compile ulang , dan jika ingin memindahkan file.jar, pindahkan juga folder yang bernama lib  di direktori yang sama dengan file.jar .

Fibbonacci Dengan Bahasa Java

9/21/2016 03:17:00 PM Add Comment
Fibbonacci Dengan Bahasa Java

Bahasa baru pengalaman baru, udah semester 3 sudah waktunya bertemu java, untuk saya di masa depan, dengan ini adalah pengingat bahwa kamu dahulu perna menjadi orang yang tidak tau dengan pemograman ini :

Kodingan Fibonnacii :
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package fibonacci;

/**
 *
 * @author SystemFive
 */
public class Fibonacci {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int temp,start_angka,angka,counter,start_counter;
        angka = 1;
        start_angka = 0;
        counter = 10;
        for(start_counter = 1; start_counter <= counter; start_counter++)
        {
            temp = angka + start_angka;
            angka = start_angka;
            start_angka = temp;
            System.out.print(temp+",");
        }
       
    }
    
}

Jika sudah selesai run melalaui IDE favorit kalian atau bisa run via CMD : java -jar <tempat_filejar>