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? Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
marcus Posted November 14, 2006 Author Share Posted November 14, 2006 no errors show up :) Quote Link to comment 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 :) Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.