update

Robert James M · Sep 15, 2012
mas aku mau tanya, umumnya tutorial untuk update data kan dibuat suatu tabel lalu dipilih, nah bagaimana misalkan saat kita login terus kita bisa update diri sendiri?

terima kasih
Silahkan login untuk menjawab!
0
Loading...
Ellyx Christian · Sep 15, 2012 · 0 Suka · 0 Tidak Suka
itu tergantung lagi dari kode login yang sudah kamu buat.
-2
Loading...
Robert James M · Sep 15, 2012 · 0 Suka · 2 Tidak Suka
ada contohnya mas? atau tutorialnya?
0
Loading...
Ellyx Christian · Sep 17, 2012 · 0 Suka · 0 Tidak Suka
makanya kasi lihat kode login dan struktur table kamu.
0
Loading...
Robert James M · Sep 17, 2012 · 0 Suka · 0 Tidak Suka
untuk kode login mas


<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="utf-8">
<link href="css/mini.php?files=reset,common,form,standard,special-pages" rel="stylesheet" type="text/css">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/png" href="favicon-large.png">
<script type="text/javascript" src="js/mini.php?files=html5,jquery-1.4.2.min,old-browsers,common,standard,jquery.tip.js"></script>
<!--[if lte IE 8]><script type="text/javascript" src="js/standard.ie.js"></script><![endif]-->


</head>
<body class="special-page login-bg dark">
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->

<section id="login-block">
<div class="block-border"><div class="block-content">

<h1>Tes</h1>
<div class="block-header">Please login</div>

<form class="form with-margin" method="post" action="log_total.php">
<input type="hidden" name="a" id="a" value="send">
<p class="inline-small-label">
<label for="name"><span class="big">User name</span></label>
<input type="text" name="user" id="username" class="full-width" value="">
<script type="text/javascript">
document.getElementById('admin_username').focus();
</script>
</p>
<p class="inline-small-label">
<label for="password"><span class="big">Password</span></label>
<input type="password" name="password" id="password" class="full-width" value="">
</p>

<button type="submit" class="float-right">Login</button>
<p class="input-height">
</p>
</form>

<form class="form" id="password-recovery" method="post" action="">
<fieldset class="grey-bg no-margin collapse">
<legend><a href="#">Lost password?</a></legend>
<p class="input-with-button">
Please ask your administrator to reset your password.
</p>
</fieldset>
</form>
</div></div>
</section>

<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>

nah lanjut ke sini
<!DOCTYPE html>
<html lang="en">
    <head>

        <title>Tes</title>
        <meta charset="utf-8">
        <link href="css/mini.php?files=reset,common,form,standard,960.gs.fluid,simple-lists,block-lists,planning,table,calendars,wizard,gallery" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
        <link rel="icon" type="image/png" href="favicon-large.png">
        <script type="text/javascript" src="js/mini.php?files=html5,jquery-1.4.2.min,old-browsers,jquery.accessibleList,searchField,common,standard,jquery.tip,jquery.hashchange,jquery.contextMenu,list"></script>
        <!--[if lte IE 8]><script type="text/javascript" src="js/standard.ie.js"></script><![endif]-->
        <script type="text/javascript" src="iqapps.0.1/js/iq.js"></script>
        

    </head>

    <body class="putih">
        <!--[if lt IE 9]><div class="ie"><![endif]-->
        <!--[if lt IE 8]><div class="ie7"><![endif]-->
        <a name="atas"></a>
        <nav id="main-nav">

		
         
		
					

			

</nav> <br></br><br></br>
        
<script type="text/javascript">
function iqShowDiv(divName){
    document.getElementById(divName).style.display='block';
}
function iqHideDiv(divName){
    document.getElementById(divName).style.display='none';
}
</script>
<div class="columns">
    <!-- Left column -->
    
            
    <div class="colx3-center">
        <div class="block-content">
            <h1>Welcome</h1>
            <div class="columns">
              <div class="colx2-left form">
                <fieldset>
                  <legend>Select</legend>

<?php

session_start();
mysql_connect   ("localhost","root","") or die ("tidak koneksi");
mysql_select_db ("project");

$user     = $_POST['user'];
$password = $_POST['password'];


$query  = "SELECT * FROM login WHERE user = '$user'"; 
$hasil  = mysql_query($query); 
$data   = mysql_fetch_array($hasil); 

if ($password== $data['password'])

{


$_SESSION['status'] = $data ['status'];
$_SESSION['user']	= $data ['user'];

include "masuk.php";
}
else {
      unset($_SESSION['user']); 
	    unset($_SESSION['status']);
      header  ("location:login.php"); 
}
?> 
                </fieldset>
              </div>
            </div>
        </div>
        
    </div>
    </div>
    </div>
		</section>

		<div class="clear"></div>

	<footer>

		<div class="float-left">
      <a href="#" class="button">Powered by Hafiz</a>
			<a href="#" class="button">Help</a>
		</div>

		<div class="float-right">
			 <a href="/.phpx#atas" class="button"><img src="images/icons/fugue/navigation-090.png" width="16" height="16"> Page top</a>
		</div>

	</footer>
<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>

lalu ke halaman update

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Tes</title>
        <meta charset="utf-8">
        <link href="css/mini.php?files=reset,common,form,standard,960.gs.fluid,simple-lists,block-lists,planning,table,calendars,wizard,gallery" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
        <link rel="icon" type="image/png" href="favicon-large.png">
        <script type="text/javascript" src="js/mini.php?files=html5,jquery-1.4.2.min,old-browsers,jquery.accessibleList,searchField,common,standard,jquery.tip,jquery.hashchange,jquery.contextMenu,list"></script>
        <!--[if lte IE 8]><script type="text/javascript" src="js/standard.ie.js"></script><![endif]-->
        <script type="text/javascript" src="iqapps.0.1/js/iq.js"></script>
    </head>


    <body class="putih">
        <!--[if lt IE 9]><div class="ie"><![endif]-->
        <!--[if lt IE 8]><div class="ie7"><![endif]-->
        <a name="atas"></a>
        
    <body class="putih">
        <!--[if lt IE 9]><div class="ie"><![endif]-->
        <!--[if lt IE 8]><div class="ie7"><![endif]-->
        <a name="atas"></a>
        <nav id="main-nav">


		<ul class="container_12">

			<li class="home current"><a href="#" title="Home">Home</a>
				<ul>
					<li class="current"><a href="#" title="Dashboard">Dashboard</a></li>
					<li><a href="#" title="My profile">My profile</a></li>
					<li class="with-menu"><a href="#" title="My settings">My settings</a>
						<div class="menu">
							<img src="images/menu-open-arrow.png" width="16" height="16">
							<ul>
								<li class="icon_address"><a href="#">Browse by</a>
									<ul>
										<li class="icon_blog"><a href="#">Blog</a>
											<ul>
												<li class="icon_alarm"><a href="#">Recents</a>
													<ul>
														<li class="icon_building"><a href="#">Corporate blog</a></li>
														<li class="icon_newspaper"><a href="#">Press blog</a></li>
													</ul>
												</li>
												<li class="icon_building"><a href="#">Corporate blog</a></li>
												<li class="icon_computer"><a href="#">Support blog</a></li>
												<li class="icon_search"><a href="#">Search...</a></li>
											</ul>
										</li>
										<li class="icon_server"><a href="#">Website</a></li>
										<li class="icon_network"><a href="#">Domain</a></li>
									</ul>
								</li>
								<li class="icon_export"><a href="#">Export</a>
									<ul>
										<li class="icon_doc_excel"><a href="#">Excel</a></li>
										<li class="icon_doc_csv"><a href="#">CSV</a></li>
										<li class="icon_doc_pdf"><a href="#">PDF</a></li>
										<li class="icon_doc_image"><a href="#">Image</a></li>
										<li class="icon_doc_web"><a href="#">Html</a></li>
									</ul>
								</li>
								<li class="sep"></li>
								<li class="icon_refresh"><a href="#">Reload</a></li>
								<li class="icon_reset">Reset</li>
								<li class="icon_search"><a href="#">Search</a></li>
								<li class="sep"></li>
								<li class="icon_terminal"><a href="#">Custom request</a></li>
								<li class="icon_battery"><a href="#">Stats server load</a></li>
							</ul>
						</div>
					</li>
				</ul>
			</li>
			<li class="write"><a href="#" title="Write">Write</a>
				<ul>
					<li><a href="#" title="Add article">Add article</a></li>
					<li><a href="#" title="Posts">Posts</a></li>
					<li><a href="#" title="Add post">Add post</a></li>
				</ul>
			</li>
			<li class="comments"><a href="#" title="Comments">Comments</a>
				<ul>
					<li><a href="#" title="Manage">Manage</a></li>
					<li><a href="#" title="Spams">Spams</a></li>
				</ul>
			</li>
			<li class="medias"><a href="#" title="Medias">Medias</a>
				<ul>
					<li><a href="#" title="Browse">Browse</a></li>
					<li><a href="#" title="Add file">Add file</a></li>
  				<li><a href="#" title="Manage">Manage</a></li>
					<li><a href="#" title="Settings">Settings</a></li>
				</ul>
		  </li>
			<li class="users"><a href="#" title="Users">Users</a>
				<ul>
					<li><a href="#" title="Browse">List</a></li>
					<li><a href="#" title="Add user">Add user</a></li>
					<li><a href="#" title="Settings">Settings</a></li>
				</ul>
			</li>
			<li class="stats"><a href="#" title="Stats">Stats</a></li>
			<li class="settings"><a href="#" title="Settings">Settings</a></li>
			<li class="backup"><a href="#" title="Backup">Backup</a></li>
		</ul>
	</nav> <br></br><br></br>

  
<script type="text/javascript">

   

</script>

<?php

  mysql_connect   ("localhost", "root", "");
  mysql_select_db ("project");
  
  $kode       = $_GET['kode'];
  
  
  $data       = mysql_query("SELECT * FROM user WHERE kode = '$kode'");

  $hasil      = mysql_fetch_array($data);
?>                    


<form class="block-content form" name="form_account_edit" id="form_account_edit" method="post" enctype="multipart/form-data" action="http://localhost/jadi/update_staff_proses.php" onsubmit="return IQ.checkForm(this,'checkPasswordAndPicture(document.form_account_edit);');">
    
    <div class="block-header">Personal Setting</div>
    <div class="columns">
        <div class="colx2-left">
            <fieldset>
                <legend>Profile</legend>

                <table cellpadding="3" class="table-padding">
                    <tr title="Required">
                        <td><b>Kode</b><span class="required">*</span></td>
                        <td>:</td>
                        <td><input type="text" name="kode" validation="isNotEmpty" title="kode" style="width:300px" value="<?php echo $kode; ?>" /></td>
                    </tr>
                    <tr title="Required">
                        <td><b>Full name</b><span class="required">*</span></td>
                        <td>:</td>
                        <td><input type="text" name="nama" validation="isNotEmpty" title="nama" style="width:300px" value="<?php echo $hasil['nama']; ?>" /></td>
                    </tr>
                    <tr title="Required">
                        <td><b>User</b><span class="required">*</span></td>
                        <td>:</td>
                        <td><input type="text" name="user" validation="isNotEmpty,isEmail" title="Email" style="width:300px;" value="<?php echo $hasil['user']; ?>" /></td>
                    </tr>
                   

                </table>
            </fieldset>
        </div>
        <div class="colx2-right">
            <fieldset>
                <legend>Login</legend>

                <table cellpadding="3" class="table-padding">
                    <tr>
                        <td><b>Password</b></td>
                        <td>:</td>
                        <td><input type="password" validation="" title="password" name="password" style="width:200px" value="<?php echo $hasil['password']; ?>" /></td>
                    </tr>
                    <tr>
                        <td><b>Status</b></td>
                        <td>:</td>
                        <td><input type="text" validation="" title="status" name="status" style="width:200px" value="<?php echo $hasil['status']; ?>" /></td>
                    </tr>
                    <tr>
                        <td><b>Transaksi</b></td>
                        <td>:</td>
                        <td><input type="text" validation="" title="transaksi" name="transaksi" style="width:200px" value="<?php echo $hasil['transaksi']; ?>" /></td>
                    </tr>
                    
                </table>
                </fieldset>
        </div>
    </div>
    <div class="block-footer" style="height:30px;">
        &nbsp;
        <div class="float-right">
            <button type="submit"><img src="images/icons/fugue/tick-octagon.png" width="16" height="16"> Save</button>
            <button type="reset" class="grey" onclick="this.form.reset();"><img src="images/icons/fugue/arrow-circle.png" width="16" height="16"> Reset</button>
            <button type="reset" class="red" onclick="document.location.href='http://apps.sibisa.com/.phpx';"><img src="images/icons/fugue/cross-white.png" width="16" height="16"> Cancel</button>
        </div>
    </div>
</form>
<br>
<p>
    <span class="required">*</span> Required</p>
			</div></div>
		</section>

		<div class="clear"></div>

	<footer>

		<div class="float-left">
      <a href="#" class="button">Powered by hafiz</a>
			<a href="#" class="button">Help</a>
		</div>

		<div class="float-right">
			 <a href="/s,account-.phpx#atas" class="button"><img src="images/icons/fugue/navigation-090.png" width="16" height="16"> Page top</a>
		</div>

	</footer>
<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>

oke ini struktur tabelnya mas

login : kode, user, status, password
staff : kode, nama, user, password, lokasi, status, transaksi

oke begitu mas semuanya maaf kalo jadinya repotin
0
Loading...
Ellyx Christian · Sep 30, 2012 · 0 Suka · 0 Tidak Suka
kode kamu pangjang lebar dan semuanya sangan berantakan, jadi edit halaman update pindakan kode php yang kamu buat di baris ke 119 ke baris no 1, dan ubah sedikit menjadi
<?php
session_start();
  mysql_connect   ("localhost", "root", "");
  mysql_select_db ("project");
  $data       = mysql_query("SELECT * FROM user WHERE user = '".$_SESSION['user']."'");
 
  $hasil      = mysql_fetch_array($data);
?> 
<!DOCTYPE html>
<!-- kode selanjutnya -->