edit, save, delete.

echo_sunajim · Sep 23, 2011
om cara ngrubah scrip buat edit gmna caranya untuk script ini


<?php require_once('Connections/koneksi.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET)) {
$pageNum_Recordset1 = $_GET;
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_koneksi, $koneksi);
$query_Recordset1 = "SELECT * FROM data_siswa";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $koneksi) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET)) {
$totalRows_Recordset1 = $_GET;
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$queryString_Recordset1 = "";
if (!empty($_SERVER)) {
$params = explode("&", $_SERVER);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Data Siswa TITL</title>
</head>

<body>
<table border="1">
<tr>
<td width="116"><div align="center">NISN</div></td>
<td width="125"><div align="center">Nama</div></td>
<td width="170"><div align="center">Jenis Kelamin </div></td>
<td width="94"><div align="center">Tanggal Lahir </div></td>
<td width="132"><div align="center">Alamat</div></td>
<td width="124"><div align="center">Email</div></td>
<td colspan="2"><form id="form1" name="form1" method="post" action="tambah.php">
<label>
<div align="center">
<input type="submit" name="Submit" value="Tambah Siswa" />
</div>
</label>
</form> </td>
</tr>
<?php do { ?>
<tr>
<td><div align="center"><?php echo $row_Recordset1; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1; ?></div></td>
<td width="124"><div align="center"><a href="edit.php?nisn=<?php echo $row_Recordset1; ?>">Pembaharuan</a></div></td>
<td width="124"><form id="form3" name="form3" method="post" action="">
<label>
<div align="center">
<input type="submit" name="Submit3" value="Submit" />
</div>
</label>
</form> </td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<p>
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">First</a>
<?php } // Show if not first page ?>
</td>
<td width="31%" align="center"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Previous</a>
<?php } // Show if not first page ?>
</td>
<td width="23%" align="center"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Next</a>
<?php } // Show if not last page ?>
</td>
<td width="23%" align="center"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Last</a>
<?php } // Show if not last page ?>
</td>
</tr>
</table>
</p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Silahkan login untuk menjawab!
0
Loading...
Kurosaki · Sep 26, 2011 · 0 Suka · 0 Tidak Suka
tabel databasenya mana?