-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a753964
Showing
8 changed files
with
343 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
try { | ||
$db = new PDO("mysql::host=localhost;dbname=performans_db;charset=UTF8","root",""); | ||
} catch (PDOException $e) { | ||
echo $e->getMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
include ("conn.php"); | ||
$id = $_GET['id']; | ||
// Tablonu (cedveli) sec deyirik | ||
$sql = "SELECT * FROM musteriler"; // ikinci cedvelde database | ||
$query = $db->query($sql); // de yaddasda olanlara baxmaq ucun | ||
$data = $query->fetch(PDO::FETCH_ASSOC); //Bazadan bir verini yenileyirik | ||
?> | ||
|
||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title></title> | ||
<style> | ||
table, tr, td, th, thead{ | ||
text-align: center; | ||
vertical-align: center; | ||
} | ||
|
||
</style> | ||
<!-- font awesome scripti --> | ||
<script src="https://kit.fontawesome.com/49b70e1494.js" crossorigin="anonymous"></script> | ||
<!-- bootstrapdan alindi css scripti --> | ||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> | ||
</head> | ||
|
||
<body> | ||
|
||
|
||
<div class="container" > | ||
<h4> Musteri guncelle </h4> | ||
<hr> | ||
<form action="islem/guncelle.php?id=<?php echo $_GET['id']; ?>" method="POST"> | ||
<table class="table"> | ||
|
||
<tr> | ||
<td> Musteri adi :</td><td><input type="text" name="musteri_ad" class="form-control" required value="<?php echo $data['musteri_ad'];?>" ></td> | ||
</tr> | ||
<tr> | ||
<td> Musteri soyadi :</td> <td><input type="text" name="musteri_soyad" class="form-control" required value="<?php echo $data['musteri_soyad'];?>"> </td> | ||
</tr> | ||
<tr> | ||
<td> Musteri numarasi :</td> <td> <input type="text" name="musteri_numarasi" class="form-control" required value="<?php echo $data['musteri_numara'];?>"> </td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> </td><td><input type="submit" name="musteri_guncelle" class="btn btn-success" value="Guncelle" > </td> | ||
</tr> | ||
|
||
</table> | ||
</form> | ||
|
||
</div> | ||
<!-- bootstrapdan alindi javascript scripti --> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
<?php | ||
include './conn.php'; | ||
|
||
// Tablonu (cedveli) sec deyirik | ||
$sql = "SELECT * FROM musteriler"; // ikinci cedvelde database | ||
$query = $db->query($sql); // de yaddasda olanlara baxmaq ucun | ||
$data = $query->fetchAll(PDO::FETCH_ASSOC); // Butun bazani cekirik | ||
?> | ||
|
||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title></title> | ||
<style> | ||
table, tr, td, th, thead{ | ||
text-align: center; | ||
vertical-align: center; | ||
} | ||
|
||
</style> | ||
<!-- font awesome scripti --> | ||
<script src="https://kit.fontawesome.com/49b70e1494.js" crossorigin="anonymous"></script> | ||
<!-- bootstrapdan alindi css scripti --> | ||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> | ||
</head> | ||
|
||
<body> | ||
|
||
|
||
<div class="container" > | ||
<h4> Musteri ekle </h4> | ||
<hr> | ||
<form action="islem/insert.php" method="POST"> | ||
<table class="table"> | ||
|
||
<tr> | ||
<td> Musteri adi :</td><td><input type="text" name="musteri_ad" class="form-control"></td> | ||
</tr> | ||
<tr> | ||
<td> Musteri soyadi :</td> <td><input type="text" name="musteri_soyad" class="form-control"> </td> | ||
</tr> | ||
<tr> | ||
<td> Musteri numarasi :</td> <td> <input type="text" name="musteri_numarasi" class="form-control"> </td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> </td><td><input type="submit" name="musteri_ekle" class="btn btn-success" > </td> | ||
</tr> | ||
|
||
</table> | ||
</form> | ||
|
||
|
||
|
||
<?php | ||
// $_GET den 'status' degeri gelirse | ||
|
||
if (isset($_GET['status'])) { | ||
|
||
// $_GET 'status' == "ok" a esitse | ||
if ($_GET['status'] == "ok") { | ||
?> | ||
<div class="alert alert-success"> | ||
|
||
<b> Musteri Ekleme Basarili ! </b> | ||
</div> | ||
|
||
|
||
<?php | ||
// $_GET 'status' == "no" a esitse | ||
} if ($_GET['status'] == "no") { | ||
?> | ||
|
||
<div class="alert alert-danger"> | ||
|
||
<b> Musteri Eklenmesinde Bir Hata Olustu </b> | ||
</div> | ||
<?php | ||
} | ||
// islem tamamlandiqdan sonra refresh edib index.php e geri gelsin | ||
header("Refresh:2 url=index.php"); | ||
} | ||
if (isset($_GET['dstatus'])) { | ||
|
||
// $_GET 'dstatus' == "ok" a esitse | ||
|
||
if ($_GET['dstatus'] == "ok") { | ||
?> | ||
<div class="alert alert-success"> | ||
|
||
<b> Musteri Silme Islemi Basarili ! </b> | ||
</div> | ||
|
||
|
||
<?php | ||
// $_GET 'dstatus' == "no" a esitse | ||
} if ($_GET['dstatus'] == "no") { | ||
?> | ||
|
||
<div class="alert alert-danger"> | ||
|
||
<b> Musteri Silinirken Bir Hata Olustu </b> | ||
</div> | ||
<?php | ||
} // islem tamamlandiqdan sonra refresh edib index.php e geri gelsin | ||
header("Refresh:2 url=index.php"); | ||
} | ||
|
||
if (isset($_GET['gstatus'])) { | ||
|
||
// $_GET 'gstatus' == "ok" a esitse | ||
|
||
if ($_GET['dstatus'] == "ok") { | ||
?> | ||
<div class="alert alert-success"> | ||
|
||
<b> Musteri Guncelleme Islemi Basarili ! </b> | ||
</div> | ||
|
||
|
||
<?php | ||
// $_GET 'gstatus' == "no" a esitse | ||
} if ($_GET['gstatus'] == "no") { | ||
?> | ||
|
||
<div class="alert alert-danger"> | ||
|
||
<b> Musteri Guncellenirken Bir Hata Olustu </b> | ||
</div> | ||
<?php | ||
} // islem tamamlandiqdan sonra refresh edib index.php e geri gelsin | ||
header("Refresh:2 url=index.php"); | ||
} | ||
?> | ||
|
||
<!-- musteri siralamasina baxmaq ucun table --> | ||
|
||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th scope="col">ID</th> | ||
<th scope="col">Musteri adi</th> | ||
<th scope="col">Musteri soyadi</th> | ||
<th scope="col">Musteri numarasi</th> | ||
<th scope="col">Islemler </th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php foreach ($data as $datas) : ?> | ||
<tr> | ||
<td> <?php echo $datas['id']; ?> </td> | ||
<td> <?php echo $datas['musteri_ad']; ?> </td> | ||
<td> <?php echo $datas['musteri_soyad']; ?> </td> | ||
<td> <?php echo $datas['musteri_numara']; ?> </td> | ||
<td> | ||
<!-- guncelle duymesini basanda guncellesayfa.php ye getmesi --> | ||
<!-- ucun <a> taginin icinde href="" istifade edirik --> | ||
|
||
<a class="btn btn-success" href="guncellesayfa.php?id=<?php echo $datas['id']; ?>"> <i class="fa-solid fa-pen"></i> </a> | ||
<!-- sil duymesini basanda sil.php ye getmesi --> | ||
<!-- ucun <a> taginin icinde href="" istifade edirik --> | ||
<a class="btn btn-danger" href="islem/sil.php?id=<?php echo $datas['id']; ?>"> <i class="fa-solid fa-trash"></i> </a> | ||
</td> | ||
</tr> | ||
<?php endforeach; ?> | ||
</tbody> | ||
</table> | ||
</div> | ||
<!-- bootstrapdan alindi javascript scripti --> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
include ("../conn.php"); | ||
|
||
if (isset($_POST['musteri_guncelle'])) { | ||
|
||
$id = $_GET['id']; | ||
$musteri_ad = $_POST['musteri_ad']; | ||
$musteri_soyad = $_POST['musteri_soyad']; | ||
$musteri_numara = $_POST['musteri_numarasi']; | ||
|
||
$sql = "UPDATE musteriler SET musteri_ad = ?, musteri_soyad = ?, musteri_numara = ? WHERE id = '$id'"; | ||
|
||
// database baglan bunu hazirla ve | ||
|
||
$query = $db->prepare($sql); | ||
$query->execute(array( | ||
$musteri_ad, $musteri_soyad, $musteri_numara | ||
)); | ||
|
||
$count = $query->rowCount(); | ||
|
||
if ($count > 0) { | ||
header("Location: ../index.php?gstatus=ok"); | ||
} else { | ||
header("Location: ../index.php?gstatus=no"); | ||
} | ||
exit; | ||
|
||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php include ("../conn.php"); | ||
|
||
|
||
if(isset($_POST['musteri_ekle'])){ | ||
$musteri_ad = $_POST['musteri_ad']; | ||
$musteri_soyad = $_POST['musteri_soyad']; | ||
$musteri_numarasi = $_POST['musteri_numarasi']; | ||
|
||
// SQL qeydiyyat aparmaq ucun | ||
$sql = "INSERT INTO musteriler (musteri_ad, musteri_soyad, musteri_numara) VALUES('$musteri_ad', '$musteri_soyad', '$musteri_numarasi')"; | ||
|
||
$query = $db->prepare($sql); | ||
$query -> execute(); | ||
|
||
$count = $query->rowCount(); | ||
|
||
if($count > 0) { | ||
header("Location: ../index.php?status=ok"); | ||
} | ||
else { | ||
header("Location: ../index.php?status=no"); | ||
} | ||
exit; | ||
} | ||
|
||
|
||
?> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
include ("../conn.php"); | ||
|
||
// GET den gelen id | ||
$id = $_GET['id']; | ||
|
||
// Database de musteriler tablosundan verilen id uzre sil | ||
|
||
$sql = "DELETE FROM musteriler WHERE id= '$id'"; | ||
|
||
$query = $db->query($sql); | ||
$count = $query->rowCount(); | ||
|
||
if ($count > 0) { | ||
header("Location: ../index.php?dstatus=ok"); | ||
} else { | ||
header("Location: ../index.php?dstatus=no"); | ||
} | ||
exit; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
include.path=${php.global.include.path} | ||
php.version=PHP_70 | ||
source.encoding=UTF-8 | ||
src.dir=. | ||
tags.asp=false | ||
tags.short=false | ||
web.root=. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://www.netbeans.org/ns/project/1"> | ||
<type>org.netbeans.modules.php.project</type> | ||
<configuration> | ||
<data xmlns="http://www.netbeans.org/ns/php-project/1"> | ||
<name>phpCrud</name> | ||
</data> | ||
</configuration> | ||
</project> |