BTC USD 86,051.5 Gold USD 4,345.18
Time now: Jun 1, 12:00 AM

problem connection php

Array $paparkandata, datang dari mana ?

salam semua,sy ade buat coding utuk edit,update data.tp ble run,page tu,xpggil balik data yang ade dlm mysql.sy nak pggil balik page tu then edit data2 tu.

coding edit data :
PHP:
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
background-color: #0033CC;
}

.oneColElsCtrHdr #container {
width: 46em; /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */
background: #FFFFFF;
margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
}
.oneColElsCtrHdr #header { 
background: #DDDDDD; 
padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
} 
.oneColElsCtrHdr #header h1 {
margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.oneColElsCtrHdr #mainContent {
padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
background: #FFFFFF;
}
.oneColElsCtrHdr #footer { 
padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
background:#DDDDDD;
} 
.oneColElsCtrHdr #footer p {
margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
.style1 {
font-size: larger
}
.style3 {font-size: xx-small}
-->
</style>

</head>

<body class="oneColElsCtrHdr">

<div id="container">
<div id="header">
<div align="right">
<embed src="../img/new.swf" width="705" height="171" /> 
<?php
$timezone = "Asia/Hong_Kong";
if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone);
echo date('d-m-Y H:i:s');
?>
</div>
</div>
<div id="mainContent">
<table width="711" border="2" align="center">
<tr>
<td width="127"><form id="form1" name="form1" method="post" action="pentadbir_kemaskini maklumat pekerja.php">
<label></label>
<input type="submit" name="button" id="button" value="Kemaskini Maklumat Pekerja" />
</form> </td>
<td width="150"><form id="form2" name="form2" method="post" action="pentadbir_tambah maklumat pekerja.php">
<label>
<input type="submit" name="button2" id="button2" value="Tambah Pekerja" />
</label>
</form> </td>
<td width="148"><form id="form3" name="form3" method="post" action="pentadbir.php">
<label>
<input type="submit" name="button3" id="button3" value="Menu Pentadbir" />
</label>
</form> </td>
</tr>
</table>
<?php
$timezone = "Asia/Kuala_Lumpur";
if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone);
echo date('d-m-Y h:i:s');
?>
<h2 align="center" class="style1">Edit Maklumat Pentadbir</h2>
<table width="377" border="2" align="center">
<tr>
<td width="182">Nama</td>
<td width="9">:</td>
<td width="162"><form id="form4" name="form4" method="post" action="update.php">
<label>
<input type="text" name="textfield" id="textfield" value="<?php echo $paparkandata[Nama] ?>" /><input name="id" type="hidden" value="<?php echo $id ?>" />
</label>
</form> </td>
</tr>
<tr>
<td>Jawatan</td>
<td>:</td>
<td>
<label>
<input type="text" name="textfield2" id="textfield2" value="<?php echo $paparkandata[Jawatan] ?>" />
</label>
</td>
</tr>
<tr>
<td>Bahagian</td>
<td>:</td>
<td>
<label>
<input type="text" name="textfield3" id="textfield3" value="<?php echo $paparkandata[Bahagian] ?>" />
</label>
</td>
</tr>
<tr>
<td>No.Telefon</td>
<td>:</td>
<td>
<label>
<input type="text" name="textfield4" id="textfield4" value="<?php echo $paparkandata[No_Telefon] ?>" />
</label>
</td>
</tr>
<tr>
<td>No.Kad Pengenalan</td>
<td>:</td>
<td>
<label>
<input type="text" name="textfield5" id="textfield5" value="<?php echo $paparkandata[No_KP] ?>" />
</label>

</td>
</tr>
<tr>
<td>Kata Laluan</td>
<td>:</td>
<td>
<label>
<input type="text" name="textfield6" id="textfield6" value="<?php echo $paparkandata[Kata_Laluan] ?>" />
</label>

</td>
</tr>
</table>
<div align="center">
<input type="submit" name="button4" id="button4" value="Submit" />
<!-- end #mainContent -->
</div>
</form>
</div>
<div id="footer">
<p align="center" class="oneColElsCtrHdr style3">Hak cipta terpelihara.Jabatan Pertahanan Awam Malaysia</p>
<!-- end #footer --></div>
<!-- end #container --></div>
<div align="center"></div>
</body>
</html>

[SIZE="5"][B]coding update :[/B][/SIZE]
<!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>
<?php
	include("../connect db/connct.php");
	
	$id=$_POST["id"];
		
	$update = mysql_query("UPDATE pengguna
	                       SET Nama='".$_POST["textfield"]."', 
							Jawatan='".$_POST["textfield2"]."',
							Bahagian='".$_POST["textfield3"]."',
							No_Telefon='".$_POST["textfield4"]."',
							No_KP='".$_POST["textfield5"]."',
							Kata_Laluan='".$_POST["textfield6"]."'
							  
						   WHERE id='$id'");
						   
if ($update)
	{
		echo("<SCRIPT language='javascript'> 
				window.alert('Rekod BERJAYA dikemaskini');
				window.location='pentadbir_kemaskini maklumat pentadbir.php'; 
			  </SCRIPT>");
  		exit; 
	}
	else
	{
		echo("<SCRIPT language='javascript'> 
				window.alert('Rekod GAGAL dikemaskini');
				window.location='pentadbir_edit maklumat pentadbir.php'; 
			  </SCRIPT>");
  		exit; 
	}
?>

</head>

<body bgcolor="#999999">
</body>
</html>
((
 
ni coding nye y tol,,


<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
background-color: #0033CC;
}

.oneColElsCtrHdr #container {
width: 46em; /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */
background: #FFFFFF;
margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
}
.oneColElsCtrHdr #header {
background: #DDDDDD;
padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
}
.oneColElsCtrHdr #header h1 {
margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.oneColElsCtrHdr #mainContent {
padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
background: #FFFFFF;
}
.oneColElsCtrHdr #footer {
padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
background:#DDDDDD;
}
.oneColElsCtrHdr #footer p {
margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
.style1 {
font-size: larger
}
.style3 {font-size: xx-small}
-->
</style>

</head>

<body class="oneColElsCtrHdr">

<div id="container">
<div id="header">
<div align="right">
<embed src="../img/new.swf" width="705" height="171" />
<?php
$timezone = "Asia/Kuala_Lumpur";
if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone);
echo date('d-m-Y h:i:s');
?>
</div>
</div>
<div id="mainContent">
<table width="711" border="2" align="center">
<tr>
<td width="127"><form id="form1" name="form1" method="post" action="pentadbir_kemaskini maklumat pekerja.php">
<label></label>
<input type="submit" name="button" id="button" value="Kemaskini Maklumat Pekerja" />
</form> </td>
<td width="150"><form id="form2" name="form2" method="post" action="pentadbir_tambah maklumat pekerja.php">
<label>
<input type="submit" name="button2" id="button2" value="Tambah Pekerja" />
</label>
</form> </td>
<td width="148"><form id="form3" name="form3" method="post" action="pentadbir.php">
<label>
<input type="submit" name="button3" id="button3" value="Menu Pentadbir" />
</label>
</form> </td>
</tr>
</table>
<?php
include("../connect db/connct.php");
$id = $_GET["id"];

$edit=mysql_query("SELECT *
FROM pengguna
WHERE id = '$id' ");

$paparkandata=mysql_fetch_assoc($edit);
?>
<h2 align="center" class="style1">Edit Maklumat Pentadbir</h2>
<table width="377" border="2" align="center">
<tr>
<td width="182">Nama</td>
<td width="9">:</td>
<td width="162"><form id="form4" name="form4" method="post" action="update.php">
<label>
<input type="text" name="textfield" id="textfield" value="<?php echo $paparkandata[Nama] ?>" /><input name="id" type="hidden" value="<?php echo $id ?>" />
</label>
</form> </td>
</tr>
<tr>
<td>Jawatan</td>
<td>:</td>
<td>
<label>
<input type="text" name="textfield2" id="textfield2" value="<?php echo $paparkandata[Jawatan] ?>" />
</label>
</td>
</tr>
<tr>
<td>Bahagian</td>
<td>:</td>
<td>
<label>
<input type="text" name="textfield3" id="textfield3" value="<?php echo $paparkandata[Bahagian] ?>" />
</label>
</td>
</tr>
<tr>
<td>No.Telefon</td>
<td>:</td>
<td>
<label>
<input type="text" name="textfield4" id="textfield4" value="<?php echo $paparkandata[No_Telefon] ?>" />
</label>
</td>
</tr>
<tr>
<td>No.Kad Pengenalan</td>
<td>:</td>
<td>
<label>
<input type="text" name="textfield5" id="textfield5" value="<?php echo $paparkandata[No_KP] ?>" />
</label>

</td>
</tr>
<tr>
<td>Kata Laluan</td>
<td>:</td>
<td>
<label>
<input type="text" name="textfield6" id="textfield6" value="<?php echo $paparkandata[Kata_Laluan] ?>" />
</label>

</td>
</tr>
</table>
<div align="center">
<input type="submit" name="button4" id="button4" value="Submit" />
<!-- end #mainContent -->
</div>
</form>
</div>
<div id="footer">
<p align="center" class="oneColElsCtrHdr style3">Hak cipta terpelihara.Jabatan Pertahanan Awam Malaysia</p>
<!-- end #footer --></div>
<!-- end #container --></div>
<div align="center"></div>
</body>
</html>
 
cuba taip
PHP:
print_r($paparkandata)

- $id tu betul atau tidak?
 
include("../connect db/connct.php");

ni run kat windows ke linux?
confirm ke jumpa file tu bila include?
 
Back
Top
Log in Register