Hi all..
Can anyone help me with this problem?
This code already said successfully update and successfully delete but actually there is no data updated or deleted.
There is no error shows too..
These are the code for update and delete data..
update_user.php
<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("pqs", $con);
$ref1 = $_REQUEST['ref1'];
$result = mysql_query("SELECT User_tcno, User_name, User_dep, User_username, User_password, User_level FROM userdb WHERE User_id = '$ref1' LIMIT 0,1");
?>
<form action="update_user1.php" method="post" name="form1" id="form1">
<p> </p>
<?php while($row = mysql_fetch_array($result))
{
?>
<table width="545" border="0" align="center" bordercolor="#F0F0F0">
<tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
<th width="196" scope="col"><div align="right" class="style9">User TC No. </div></th>
<th width="5" scope="col"><div align="center"><strong>:</strong></div></th>
<th width="330" scope="col"><div align="left">
<input name="User_tcno" type="text" id="User_tcno" value="<?php echo $row['User_tcno'];?>" size="40" />
</div></th>
</tr>
<tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
<th scope="row"><div align="right" class="style9">User Name </div></th>
<td><div align="center"><strong>:</strong></div></td>
<td><input name="User_name" type="text" id="User_name" value="<?php echo $row['User_name'];?>" size="40" /></td>
</tr>
<tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
<th scope="row"><div align="right" class="style9">Department</div></th>
<td><div align="center"><strong>:</strong></div></td>
<td><input name="User_dep" type="text" id="User_dep" value="<?php echo $row['User_dep'];?>" size="40" /></td>
</tr>
<tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
<th scope="row"><div align="right" class="style9">Access Username </div></th>
<td><div align="center"><strong>:</strong></div></td>
<td><input name="User_username" type="text" id="User_username" value="<?php echo $row['User_username'];?>" size="40" /></td>
</tr>
<tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
<th scope="row"><div align="right" class="style9">Access Password </div></th>
<td><div align="center"><strong>:</strong></div></td>
<td><div align="left">
<input name="User_password" type="text" id="User_password" value="<?php echo $row['User_password'];?>" size="40" />
</div></td>
</tr>
<tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
<th height="24" scope="row"><div align="right" class="style9">Access Level </div></th>
<td><div align="center"><strong>:</strong></div></td>
<td><div align="left">
<select name="User_level" id="User_level">
<option value="<?php echo $row['User_level'];?>"><?php echo $row['User_level'];?></option>
<option value="-">Select level</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div></td>
</tr>
<?php }?>
<tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
<th colspan="3" scope="row"><div align="right"></div></th>
</tr>
<tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
<th height="44" colspan="3" scope="row"><div align="center">
<input name="submit" type="submit" id="submit" value="Submit" onclick="show_alert()" />
<input name="Back" type="submit" id="Back" value="Back" />
</div></th>
</tr>
</table>
<?php
mysql_close($con);
?>
<p> </p>
<div id="footer">
<p align="left"><strong>Access Level description:</strong><br />
Level 1 : Admin page<br />
Level 2 : HRA page<br />
Level 3 : Guard Page </p>
</div>
</form>
update_user1.php
<?php
if (isset($_POST['submit'])){
//if (isset($_POST['User_level'])){
$link = mysql_connect("localhost","root","root") or die ("Could not connect to the Database Server!");
$db = mysql_select_db("pqs", $link) or die ("Could not select Database!");
//User_id = $_GET['User_id'];
$result = mysql_query("UPDATE userdb SET User_tcno = '$User_tcno', User_name = '$User_name', User_dep = '$User_dep', User_username = '$User_username', User_password = '$User_password', User_level = '$User_level' WHERE User_id = '$User_id'");
}
if($result){
echo "<script type='text/javascript'>window.location='index.php?page=list_user.php'</script>";
}
mysql_close();
?>
delete_user.php
<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("pqs", $con);
$User_id = $_GET['User_id'];
$result = mysql_query("DELETE FROM userdb WHERE User_id = '$User_id'");
if($result){
echo "Deleted Successfully";
echo "<script type='text/javascript'>window.location='index.php?page=list_user.php' </script>";
}
else {
echo "ERROR";
}
mysql_close($con);
?>
Please help me with this problem..
Thanks in advance..:)