26. juni 2003 - 22:42
Der er
27 kommentarer og 1 løsning
mysq - UPDATE
Den updater ikk' navnet fra formen. Tro ikk' helt at den henter den... På forhånd tak:-] >>>>>>>>>>>>>>>>>> $getSQL = mysql_query("SELECT * FROM users WHERE id='5'"); $row = mysql_fetch_array($getSQL); if($_POST[updater]) { $getSQL = mysql_query("UPDATE users SET navn='$_POST[navn]' WHERE id='5'"); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <form method="post" action="list-users.php"> <input type="hidden" name="updater" value="1"> Name<input type="text" name="navn" value="<?php echo $row['navn']; ?>"> <br> Pass 1<input type="text" name="pass" value="<?php echo $row['pass']; ?>"> <br> Pass 2<input type="text" name="pass2" value="<?php echo $row['pass']; ?>"> <br> Mail <input type="text" name="mail" value="<?php echo $row['mail']; ?>"> <br> Info <textarea name="info" cols="10" rows="5"><?php echo $row['info']; ?></textarea> <input type="submit" name="submit" value="update"> </form> <? mysql_close(); ?> >>>>>>>>>>>>>>>>>>
Annonceindlæg tema
Cloud & AI
I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
Hov :) Du har osgå et felt der hedder updater ...
mysql_query("UPDATE users SET navn='$_POST[navn]' WHERE id='5'");
if($_POST[updater]) { mysql_query("UPDATE users SET navn='$_POST[navn]' WHERE id='5'"); }
Du have bare lagt det i en variabel men udførte det ikke :o)
Mon ikke du bare skal lave din UPDATE sør din SELECT?
daaaam i her hurtige herinde:-)
26. juni 2003 - 22:49
#10
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <?php if (isset($_POST['updater']) { mysql_query("UPDATE users SET navn='$_POST[navn]' WHERE id=5"); } $getSQL = mysql_query("SELECT * FROM users WHERE id=5"); $row = mysql_fetch_array($getSQL); ?> <form method="post" action="list-users.php"> <input type="hidden" name="updater" value="1"> Name<input type="text" name="navn" value="<?php echo $row['navn']; ?>"> <br> Pass 1<input type="text" name="pass" value="<?php echo $row['pass']; ?>"> <br> Pass 2<input type="text" name="pass2" value="<?php echo $row['pass']; ?>"> <br> Mail <input type="text" name="mail" value="<?php echo $row['mail']; ?>"> <br> Info <textarea name="info" cols="10" rows="5"><?php echo $row['info']; ?></textarea> <input type="submit" name="submit" value="update"> </form> <?php mysql_close(); ?>
26. juni 2003 - 22:49
#11
hov: if (isset($_POST['updater']) { skal lige være: if (isset($_POST['updater'])) {
26. juni 2003 - 22:50
#12
Jeps byt rundt på dem som schaefner har gjort, ellers ser du ikke de nye dataer før næste gang.
26. juni 2003 - 22:55
#13
26. juni 2003 - 22:57
#14
Hvordan ser dine to scripts ud altså edit og list user
26. juni 2003 - 22:58
#15
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <?php mysql_connect("xxx","xxx","xxx"); mysql_select_db("xxx"); if (isset($_POST['updater'])) { mysql_query("UPDATE users SET navn='$_POST[navn]' WHERE id=5"); } $getSQL = mysql_query("SELECT * FROM users WHERE id=5"); $row = mysql_fetch_array($getSQL); ?> <form method="post" action="list-users.php"> <input type="hidden" name="updater" value="1"> Name<input type="text" name="navn" value="<?php echo $row['navn']; ?>"> <br> Pass 1<input type="text" name="pass" value="<?php echo $row['pass']; ?>"> <br> Pass 2<input type="text" name="pass2" value="<?php echo $row['pass']; ?>"> <br> Mail <input type="text" name="mail" value="<?php echo $row['mail']; ?>"> <br> Info <textarea name="info" cols="10" rows="5"><?php echo $row['info']; ?></textarea> <input type="submit" name="submit" value="update"> </form> <?php mysql_close(); ?> </body> </html>
26. juni 2003 - 22:59
#16
Det er da ikke det script der kører på det link?
26. juni 2003 - 22:59
#17
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>edit'da'shit</title> <link rel="stylesheet" type="text/css" href="links.css"> </head> <body text="#FFFFFF" bgcolor="#1C445D"> <font face="verdana" size="1"> <?php mysql_connect("xxx"); mysql_select_db("xxx"); $getSQL = mysql_query("SELECT * FROM users WHERE id='5'"); while($row = mysql_fetch_array($getSQL)) { echo $row["id"]." * "; echo $row["navn"]." * "; echo $row["pass"]." * "; echo $row["mail"]." * "; echo $row["info"]; echo "<br>"; } mysql_close(); ?> </body> </html>
26. juni 2003 - 22:59
#18
det skal vel være: <form method="post" action="edit-users.php">
26. juni 2003 - 22:59
#19
og list-users.php ?
26. juni 2003 - 22:59
#20
Nå jo. Men din UPDATE skal flyttes til list_user - ikke i edit>_user
26. juni 2003 - 22:59
#21
Men der har du jo ikke opdateret?
26. juni 2003 - 23:00
#22
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <?php mysql_connect("xxx","xxx","xxx"); mysql_select_db("xxx"); if (isset($_POST['updater'])) { mysql_query("UPDATE users SET navn='$_POST[navn]' WHERE id=5"); header("Location: list-users.php"); } $getSQL = mysql_query("SELECT * FROM users WHERE id=5"); $row = mysql_fetch_array($getSQL); ?> <form method="post" action="list-users.php"> <input type="hidden" name="updater" value="1"> Name<input type="text" name="navn" value="<?php echo $row['navn']; ?>"> <br> Pass 1<input type="text" name="pass" value="<?php echo $row['pass']; ?>"> <br> Pass 2<input type="text" name="pass2" value="<?php echo $row['pass']; ?>"> <br> Mail <input type="text" name="mail" value="<?php echo $row['mail']; ?>"> <br> Info <textarea name="info" cols="10" rows="5"><?php echo $row['info']; ?></textarea> <input type="submit" name="submit" value="update"> </form> <?php mysql_close(); ?> </body> </html>
26. juni 2003 - 23:00
#23
edit er den første og list den anden:-)
26. juni 2003 - 23:00
#24
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <?php mysql_connect("xxx","xxx","xxx"); mysql_select_db("xxx"); if (isset($_POST['updater'])) { mysql_query("UPDATE users SET navn='$_POST[navn]' WHERE id=5"); header("Location: list-users.php"); } $getSQL = mysql_query("SELECT * FROM users WHERE id=5"); $row = mysql_fetch_array($getSQL); ?> <form method="post" action="edit-users.php"> <input type="hidden" name="updater" value="1"> Name<input type="text" name="navn" value="<?php echo $row['navn']; ?>"> <br> Pass 1<input type="text" name="pass" value="<?php echo $row['pass']; ?>"> <br> Pass 2<input type="text" name="pass2" value="<?php echo $row['pass']; ?>"> <br> Mail <input type="text" name="mail" value="<?php echo $row['mail']; ?>"> <br> Info <textarea name="info" cols="10" rows="5"><?php echo $row['info']; ?></textarea> <input type="submit" name="submit" value="update"> </form> <?php mysql_close(); ?> </body> </html>
26. juni 2003 - 23:03
#25
yeS...thX ahy!
26. juni 2003 - 23:03
#26
<?php //De sidste 5 post hvor type = køb $conn = mysql_connect("localhost","root") or die(mysql_error()); mysql_select_db("billede") or die(mysql_error()); $query = mysql_query("SELECT * FROM billederne") or die(mysql_error()); while ($row = mysql_fetch_array($query)) { echo " <table class='tekstafsnit' width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td><b>Type: $row[type] Gruppe: $row[kate] </b> - <font color='#999999'>oprette den: $row[dato] af $row[navn]</font></td> </tr> <tr>$row[over]</tr> <tr> <td>$row[beskrivelse]</td> </tr> <tr> <td>Pris: $row[pris]</td> </tr> <tr> <td><img src='/test/$row[filnavn]'></td> <td>$row[tekst]</td> </tr> <tr> <td>IP: $row[IP]</td> </tr> </table> <br><br><br><br><br><br><br><br> "; } ?>
26. juni 2003 - 23:03
#27
Forkert vindue med det sidste her ;o) AHV, tak ;)
26. juni 2003 - 23:04
#28
:-D
Vi tilbyder markedets bedste kurser inden for webudvikling