ASsalamualaikum..
Sebelumnya kita sudah membuat tabel detail_maha_kuliah. Nah untuk sintax program simpannya berikut ni bro.
membuat_detail.php
$con=mysqli_connect("localhost","root","","my_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Create table
$sql="CREATE TABLE detail_maha_kuliah(id INT(5) AUTO_INCREMENT PRIMARY KEY,nim CHAR(10),kode CHAR(10))";
// Execute query
if (mysqli_query($con,$sql))
{
echo "Table detail_maha_kuliah created successfully";
}
else
{
echo "Error creating table: " . mysqli_error($con);
}
?>
Ambil_makul.php
Kode_ambil.php
$con=mysql_connect("localhost","root","");
mysql_select_db ("my_db" ,$con);
$nim =$_POST[nim];
$kode =$_POST[kode];
if ($nim == "") {echo "NIM Belum di Isi";}
else if ($kode == "") {echo "Kode Belum di Isi";}
else {$simpan = mysql_query("INSERT INTO detail_maha_kuliah values ('','$nim','$kode')");
if ($simpan) {echo "Data Berhasil di Simpan";}
}
?>
Sekian, Semoga Bermanfaat..
Wassalamualaikum
Sebelumnya kita sudah membuat tabel detail_maha_kuliah. Nah untuk sintax program simpannya berikut ni bro.
membuat_detail.php
$con=mysqli_connect("localhost","root","","my_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Create table
$sql="CREATE TABLE detail_maha_kuliah(id INT(5) AUTO_INCREMENT PRIMARY KEY,nim CHAR(10),kode CHAR(10))";
// Execute query
if (mysqli_query($con,$sql))
{
echo "Table detail_maha_kuliah created successfully";
}
else
{
echo "Error creating table: " . mysqli_error($con);
}
?>
Ambil_makul.php
Kode_ambil.php
$con=mysql_connect("localhost","root","");
mysql_select_db ("my_db" ,$con);
$nim =$_POST[nim];
$kode =$_POST[kode];
if ($nim == "") {echo "NIM Belum di Isi";}
else if ($kode == "") {echo "Kode Belum di Isi";}
else {$simpan = mysql_query("INSERT INTO detail_maha_kuliah values ('','$nim','$kode')");
if ($simpan) {echo "Data Berhasil di Simpan";}
}
?>
Sekian, Semoga Bermanfaat..
Wassalamualaikum
Comments
Post a Comment
Untuk Menyambung Silaturahmi, Saya Harap Kita bisa Bercakap lewat Komentar di Bawah ini.. ^_^