marcus Posted November 14, 2006 Share Posted November 14, 2006 ok, just some mysql updating a row help needed[code=php:0]if($act == edit){$q = "SELECT * FROM `shoutbox` WHERE `id`=$id";$query = mysql_query($q);$shout = mysql_fetch_array($query);echo"<table border=0 cellspacing=0 cellpadding=1><tr><td><form action=shoutadmin.php method=post>Name:<td><input type=text name=mname value=$shout[name]><tr><td>Website:<td><input type=text name=mwebsite value=$shout[website]><tr><td>Message:<td><input type=text name=mmessage value=$shout[message]><input type=hidden name=messid value=$shout[id]><input type=hidden name=action value=doedit><tr><td colspan=2><input type=submit value='Edit'></table>";}if($act == doedit){$mname = $_POST[mname];$mwebsite = $_POST[mwebsite];$mmessage = $_POST[mmessage];$messid = $_POST[messid];$sqll = "UPDATE `shoutbox` SET `name` = '$name',`website` = '$website',`message` = '$message' WHERE `id` =$messid LIMIT 1 ";$ress = mysql_query($sqll);echo"Shout Edited";}[/code]alright, the first part where it shows everything works, but when i update it, it doesnt work. it just stays the same, any ideas? Link to comment https://forums.phpfreaks.com/topic/27175-mysql-help-needed-again/ Share on other sites More sharing options...
trq Posted November 14, 2006 Share Posted November 14, 2006 You need to learn to debug. Try changes this...[code=php:0]$ress = mysql_query($sqll);[/code]to...[code=php:0]$ress = mysql_query($sqll) or die(mysql_error());[/code] Link to comment https://forums.phpfreaks.com/topic/27175-mysql-help-needed-again/#findComment-124272 Share on other sites More sharing options...
marcus Posted November 14, 2006 Author Share Posted November 14, 2006 no errors show up :) Link to comment https://forums.phpfreaks.com/topic/27175-mysql-help-needed-again/#findComment-124274 Share on other sites More sharing options...
trq Posted November 14, 2006 Share Posted November 14, 2006 ps; change this line...[code=php:0]if($act == doedit)[/code]to...[code=php:0]if($act == "doedit")[/code]Its amazing what a bit of syntax highlighting shows up. Use the [ php ] tags to post next time :) Link to comment https://forums.phpfreaks.com/topic/27175-mysql-help-needed-again/#findComment-124275 Share on other sites More sharing options...
marcus Posted November 14, 2006 Author Share Posted November 14, 2006 That would be a stupid mistake I would presume. Lemme see if it works...still not working. Link to comment https://forums.phpfreaks.com/topic/27175-mysql-help-needed-again/#findComment-124277 Share on other sites More sharing options...
trq Posted November 14, 2006 Share Posted November 14, 2006 Where do you define $name, $message and $website? Also there is no LIMIT in an UPDATE statement. Link to comment https://forums.phpfreaks.com/topic/27175-mysql-help-needed-again/#findComment-124279 Share on other sites More sharing options...
jsladek Posted November 14, 2006 Share Posted November 14, 2006 add [code]print("$sqll"); [/code]after [code]$sqll = "UPDATE `shoutbox` SET `name` = '$name',`website` = '$website',`message` = '$message' WHERE `id` =$messid LIMIT 1 ";[/code]and see what it is printing out-John Sladek Link to comment https://forums.phpfreaks.com/topic/27175-mysql-help-needed-again/#findComment-124280 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.