suaji Posted June 9, 2009 Share Posted June 9, 2009 <table width="100%" align="center"> <tr> <th align="left" valign="top" bgcolor="#000000" scope="row"><div align="center"> <p> </p> <p><strong><u>DATA</u></strong> </p> <form id="form3" name="form3" method="post" action="update.php"> <p> <?php include "connection.php"; $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); $count=mysql_num_rows($result); ?> </p> <table width="450" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC"> <tr> <td width="23" align="center" bgcolor="#000000"> </td> <td width="22" align="center" bgcolor="#000000"><div align="left"></div></td> <td width="120" align="center" bgcolor="#000000"><div align="left"><strong>Username</strong></div></td> <td width="120" align="center" bgcolor="#000000"><div align="left"><strong>Password</strong></div></td> <td width="153" align="center" bgcolor="#000000"><div align="left"><strong>Email</strong></div></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td align="center" bgcolor="#000000"><? echo $rows['id']; ?></td> <td bgcolor="#000000"><div align="left"></div></td> <td bgcolor="#000000"><div align="left"> <input name="username2" type="text" id="username3" value="<? echo $rows['username']; ?>" /> </div></td> <td width="120" align="center" bgcolor="#000000"><div align="justify"> <input name="password2" type="text" id="password3" value="<? echo $rows['password']; ?>" /> </div></td> <td width="153" align="center" bgcolor="#000000"><div align="justify"> <input name="email" type="text" id="email2" value="<? echo $rows['email']; ?>" /> </div></td> </tr> <?php } ?> <tr> <div> <td align="center" bgcolor="#000000"><div align="left"></div></td> <td align="left" bgcolor="#000000"> </td> <td align="left" bgcolor="#000000"> </td> <td align="left" bgcolor="#000000"> </td> <td align="left" bgcolor="#000000"> </td> </div> </tr> <tr> <td colspan="5" align="left" bgcolor="#000000"><input name="update" type="submit" id="update" value="Update" /></td> </tr> <? if($_POST['update'] == 'Update'){ for($i=0;$i<$count;$i++){ $update = "UPDATE $tbl_name SET username='$username', password='$password', email='$email' WHERE id='$id'"; mysql_query($update) or die(mysql_error()); echo "<meta http-equiv='refresh' content='2;url=update.php>"; } else { echo "SORRY TRY AGAIN"; echo "<meta http-equiv='refresh' content='2;url=update.php'>"; } mysql_close(); ?> </table> </form> <p> </p> <p> </p> </div></th> </tr> </table> Link to comment https://forums.phpfreaks.com/topic/161542-cant-update/ Share on other sites More sharing options...
Maq Posted June 9, 2009 Share Posted June 9, 2009 So... what exactly happens? Have you debugged anything? Does the $id get passed correctly? Does it echo "SORRY TRY AGAIN"? Are there any errors? Have you echoed out the update sql statement to see what's actually being executed? NOTE - Use <?php tags never short-hand... Link to comment https://forums.phpfreaks.com/topic/161542-cant-update/#findComment-852476 Share on other sites More sharing options...
suaji Posted June 10, 2009 Author Share Posted June 10, 2009 actly no debug.. or nothing error msg appear.. i don't know how to explain to u.. that coding was successfully can run, but when i click update button, data still not change anything.. like original in database.. Link to comment https://forums.phpfreaks.com/topic/161542-cant-update/#findComment-852982 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.