Could somebody tell me if there is anything wrong with this script? It doesn't seem to be updating to my database. <?php include("t.php"); $cat = $do->filter($_GET['cat']); $id = $do->filter($_GET['id']); $fetch = mysql_query("Select * from forum_question WHERE id='$id'"); $content = mysql_fetch_array($fetch); $contentz = stripslashes($content['detail']); $topic = stripslashes($content['topic']); $descr = stripslashes($content['descr']); $sticky = $content['issticky']; $aname = strtolower($content['name']); $signin_usernamez = strtolower($signin_username); if($sticky) { $checked = "checked=\"checked\""; } $threads = mysql_query("SELECT `id` FROM `forum_question`"); $threads = mysql_num_rows($threads); $posts = mysql_query("SELECT `a_id` FROM `forum_answer`"); $posts = mysql_num_rows($posts); if ($signin_usernamez==$aname || $signin_usernamez=="admin" || $ir['forumadmin']) { ?><div class="box5"><div class="bottom5"><div class="top5"><div class="sv"><div class="b5"> <div style="width:430px" align="center"><h2>Edit Topic</h2> <a href="javascript:;" onclick="sel('1');"><img src="images/bold.png" width="24" height="24" alt="Bold"></a> <a href="javascript:;" onclick="sel('2');"><img src="images/italic.png" width="24" height="24" alt="Italic"></a> <a href="javascript:;" onclick="sel('3');"><img src="images/underline.png" width="24" height="24" alt="Underline"></a> <a href="javascript:;" onclick="sel('4');"><img src="images/strike.gif" width="25" height="24" alt="Strike"></a> <a href="javascript:;" onclick="document.forms[0].detail.value=document.forms[0].detail.value+'[ul][li][/li][/ul]'"><img src="images/list.gif" width="24" height="24" alt="List"></a> <a href="javascript:;" onclick="document.forms[0].detail.value=document.forms[0].detail.value+'[ol][li][/li][/ol]'"><img src="images/listnumbered.gif" width="24" height="24" alt="List numbered"></a> <a href="javascript:;" onclick="image();"><img src="images/image.png" width="24" height="24" alt="Image" /></a> <a href="javascript:;" onclick="link();"><img src="images/hyperlink.png" width="16" height="16" alt="Hyperlink" /></a> <a href="javascript:;" onclick="sel('5');"><img src="images/code.png" width="16" height="16" alt="Code"></a> <a href="javascript:;" onclick="sel('6');"><img src="images/quote.png" width="24" height="24" alt="Quote"></a> <br/> <a href="javascript:;" onclick="em(':)')"><img src="images/smilie.gif" width="20" height="20" alt="Smile" /></a> <a href="javascript:;" onclick="em(':(')"><img src="images/sad.gif" width="20" height="20" alt="Sad" /></a> <a href="javascript:;" onclick="em(':angry:')"><img src="images/angry.gif" width="20" height="20" alt="Angry" /></a> <a href="javascript:;" onclick="em(':D')"><img src="images/biggrin.gif" width="18" height="18" alt="Big Grin" /></a> <a href="javascript:;" onclick="em(':blink:')"><img src="images/blink.gif" width="20" height="20" alt="Blink" /></a> <a href="javascript:;" onclick="em(':blush:')"><img src="images/blush.gif" width="18" height="18" alt="Blush" /></a> <a href="javascript:;" onclick="em('B)')"><img src="images/cool.gif" width="20" height="20" alt="Cool" /></a> <a href="javascript:;" onclick="em('^_^')"><img src="images/happy.gif" width="18" height="18" alt="Happy" /></a> <a href="javascript:;" onclick="em(':huh:')"><img src="images/confused.gif" width="18" height="25" alt="Huh" /></a> <a href="javascript:;" onclick="em(':lol:')"><img src="images/laugh.gif" width="20" height="20" alt="Laugh" /></a> <a href="javascript:;" onclick="em(':o')"><img src="images/ohmy.gif" width="18" height="18" alt="Oh My" /></a> <a href="javascript:;" onclick="em(':fear:')"><img src="images/fear.gif" width="25" height="25" alt="Fear" /></a> <a href="javascript:;" onclick="em(':rolleyes:')"><img src="images/rolleyes.gif" width="20" height="20" alt="Rolleyes" /></a> <a href="javascript:;" onclick="em(':sleep:')"><img src="images/sleep.gif" width="18" height="26" alt="Sleep" /></a> <a href="javascript:;" onclick="em(':p')"><img src="images/tongue.gif" width="20" height="20" alt="Tongue" /></a> <a href="javascript:;" onclick="em(':unsure:')"><img src="images/unsure.gif" width="18" height="18" alt="Unsure" /></a> <a href="javascript:;" onclick="em(':wacko:')"><img src="images/wacko.gif" width="18" height="25" alt="Wacko" /></a> <a href="javascript:;" onclick="em(':wink:')"><img src="images/wink.gif" width="20" height="20" alt="Wink" /></a> <a href="javascript:;" onclick="em(':wub:')"><img src="images/wub.gif" width="20" height="25" alt="Wub" /></a> </div> <form name="form1" method="post" action=""><br/> <label>Title:</label> <input name="topic" type="text" id="topic" size="50" value="<? echo $topic; ?>" /><br/> <label>Description:</label> <input name="desc" type="text" id="desc" size="50" value="<? echo $descr; ?>" /> <textarea name="answer" cols="50" rows="10" id="detail"><? echo $contentz; ?></textarea> <? if($ir['forumadmin'] || $ir['forummod']) { ?><label>Sticky topic?:</label> <input type="checkbox" name="sticky" value="1"<?php echo $checked; ?> /><?php } ?> <br/><br/><input type="button" value="Cancel" class="b9" onClick="history.go(-1)"> <input type="submit" name="Submit" class="b9" value="Edit Topic" /> </form> </div></div><div class="clr"></div></div></div></div> <? if ($_POST) { $detail = $do->filter($_POST['answer']); $id = $do->filter($_GET['id']); $topic = $do->filter($_POST['topic']); $descr = $do->filter($_POST['desc']); if($signin_usernamez != $aname){$editer = $signin_usernamez;} $sticky = $do->filter($_POST['sticky']); if(!$sticky) { $sticky = 0; } mysql_query("UPDATE forum_question SET detail='$detail',edited=unix_timestamp(), topic='$topic', descr='$descr', issticky='$sticky', editer='$editer' WHERE id='$id'"); $url = "topic.php?cat=$cat&id=$id"; print "<meta http-equiv='refresh' content='0; url=$url'>"; } }else{echo "<div align=\"center\"><div class=\"error\">You are not allowed to edit other member's posts.<br/><a href=\"javascript:history.go(-1)\">Click here</a> to go back.</div></div>"; } include("f.php"); ?> PHP:
Use mysql_error(), so you can see if it's your queries that are failing. Example: mysql_query("UPDATE forum_question SET detail='$detail',edited=unix_timestamp(), topic='$topic', descr='$descr', issticky='$sticky', editer='$editer' WHERE id='$id'") || die('Query Failed: ' . mysql_error()); PHP: