0

it doesn't have any error but also i does not update in my database?

<head>
</head>
	<?php include('connect.php');?>
<body>
	<?php
	mysql_select_db("dbusers",$connection);
	
	$result=mysql_query("UPDATE tblinfo SET idno='$idno', name='$name', address='$address', birthdate='$birthdate', contact='$contact', 		    email='$email' WHERE 'index'='$id'");

	$result = mysql_query($update)

 
?>
	
</body>
</html>
3
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by kurtopia
0

okay i doesn't changed anything.. this is the first script before it goes to my update code, can you take a look further. thou there is no problem in my viewing of records its just that

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

        	<?php include('connect.php');?>
</head>
	

    
    
<body>

	<?php
			$sqlstr=mysql_query("SELECT * FROM tblinfo");
	?>
			

   <table border="1"> 
   <tr>
   <th>IDNO</th>
   <th>Name</th>
   <th>Address</th>
   <th>Birthdate</th>
   <th>Contact</th>
   <th>Email</th>
   <th>ACTION</th>

   </tr>
	<?php
	
	while($row=mysql_fetch_array($sqlstr))
		{
			echo '<tr>';
			echo '<td>'.$row['idno'].'</td>';
	 		echo '<td>'.$row['name'].'</td>';
	 	    echo '<td>'.$row['address'].'</td>';
	   		echo '<td>'.$row['birthdate'].'</td>';
	    	echo '<td>'.$row['contact'].'</td>';
			echo '<td>'.$row['email'].'</td>';
			
			
			?>
		<td> 
        <input name="" type="button" value="edit" onclick="window.location.href='Test.php?id=<?php echo $row['id']; ?>'" />
			<?php
		
					
			echo '</tr>';
			
		}
		?>
     </table>   

</body>
</html>
0

First add the validation code as describred in the sticky (mysql_error).

Anyway, you are using id, idno and index. Probably one of them is wrong. My guess is that index in your query should be id.

Edited by pritaeas: n/a

0

The Action takes place here..

<?php include('connect.php'); ?>
 
  


</head>
		<?php
	if($_GET['id']){
	$select_one = mysql_query("SELECT * FROM tblinfo WHERE id = '$_GET[id]'");
	if ($select_one){
	while ($row = mysql_fetch_array($select_one)){
	$idno = $row['idno'];
	$name = $row['name'];
	$address = $row['address'];
	$birthdate = $row['birthdate'];
	$contact = $row['contact'];
	$email = $row['email'];
}
}
}
?>

<body>
	<form action="" method="POST" name="Test" onsubmit="return validateForm()">
    
   	 <h6>Idno</h6> <input name="idno" type="text" value="<?php echo $idno;?>"/><br />
     
	 <h6>Name</h6><input name="name" type="text" value="<?php echo $name;?>"/><br />
     
     <h6>Address</h6><input name="address" type="text" value="<?php echo $address;?>"/><br />
	 
	 <h6>Birthdate</h6><input name="birthdate" type="text" value="<?php echo $birthdate;?>"/><br />
	 
	 <h6>Contact</h6><input name="contact" type="text" value="<?php echo $contact;?>"/><br />
     
	 <h6>E-Mail</h6><input name="email" type="text" value="<?php echo $email;?>"/></br>
	
	 <input type="submit" name="save" id="submit" value="save"> 
      <input type="submit" name="update" id="submit" value="update"> 
            <input type="submit" name="delete" id="submit" value="delete"> 
	 <br />

    </form>
					<?php
                if(!empty($_REQUEST['update']))
                {
                   echo include('update.php');
                }
                else
                if(!empty($_REQUEST['save']))
                {
                	echo include('save.php');
                }
				else
                if(!empty($_REQUEST['delete']))
                {
                	echo include('delete.php');
                }
		
                ?>

</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.