jlhaslip Posted November 13, 2008 Share Posted November 13, 2008 As I suspected, the literal value: " $id " is being used as the search key for the delete function.Can you post the section of the script which handles the echoing of the 'delete' link? and the DB Query it uses, please.this is getting very close to completion. Just needs a minor adjustment to pick up the correct id value. Link to comment Share on other sites More sharing options...
toxic27 Posted November 13, 2008 Author Share Posted November 13, 2008 echo '</tr><tr>';if($session->isAdmin()){echo '<td align="left" style="text-indent: 14pt" colspan="2"><h5> '.stripslashes($info2->comment).'<br><a href="delete_comment.php?comment_id=$id">DELETE</a></h5><br></td>';}else{echo '<td align="left" style="text-indent: 14pt" colspan="2"><h5> '.stripslashes($info2->comment).'</h5><br></td>';}echo '</tr><tr>'; And what do you mean about the Database Query? MyPHPAdmin stuff? Link to comment Share on other sites More sharing options...
jlhaslip Posted November 13, 2008 Share Posted November 13, 2008 No, not phpmyadmin stuff.Someplace in the same file as the delete code listed above is a mySql Query. Can you find it and list it here, thanks. Link to comment Share on other sites More sharing options...
toxic27 Posted November 13, 2008 Author Share Posted November 13, 2008 Oh ok, this right? //query comments for this page of this article$inf = "SELECT * FROM `comments` WHERE page = '".stripslashes($_SERVER['REQUEST_URI'])."' ORDER BY time ASC";$info = mysql_query($inf);if(!$info) die(mysql_error()); Link to comment Share on other sites More sharing options...
jlhaslip Posted November 13, 2008 Share Posted November 13, 2008 And what follows that code?Copy all the code between that query and the Delete code section, please. Link to comment Share on other sites More sharing options...
toxic27 Posted November 13, 2008 Author Share Posted November 13, 2008 //query comments for this page of this article$inf = "SELECT * FROM `comments` WHERE page = '".stripslashes($_SERVER['REQUEST_URI'])."' ORDER BY time ASC";$info = mysql_query($inf);if(!$info) die(mysql_error());$req_user_info = $database->getUserInfo($req_user);$info_rows = mysql_num_rows($info);if($info_rows > 0) {echo '<table width="400pt">';while($info2 = mysql_fetch_object($info)) { echo '<tr>'; if($session->logged_in){echo '<td><div style="color: lightslategray" align="left"><br><h5>Comment by '.$req_user_info['username'].' on '.$info2->date.'</h5></b></div></td>';}else{echo '<td><div style="color: lightslategray" align="left"><br><h5>Comment by '.$req_user_info['username'].' on '.$info2->date.'</h5></b></div></td>';}echo '</tr><tr>';if($session->isAdmin()){echo '<td align="left" style="text-indent: 14pt" colspan="2"><h5> '.stripslashes($info2->comment).'<br><a href="delete_comment.php?comment_id=$id">DELETE</a></h5><br></td>';}else{echo '<td align="left" style="text-indent: 14pt" colspan="2"><h5> '.stripslashes($info2->comment).'</h5><br></td>'; Here you go Link to comment Share on other sites More sharing options...
jlhaslip Posted November 13, 2008 Share Posted November 13, 2008 I am not familiar with OOPS style code. More a procedural guy, myself, but try this: if($session->isAdmin()){$id = $info2->id;echo '<td align="left" style="text-indent: 14pt" colspan="2"><h5> '.stripslashes($info2->comment).'<br><a href="delete_comment.php?comment_id=$id">DELETE</a></h5><br></td>';} Link to comment Share on other sites More sharing options...
toxic27 Posted November 13, 2008 Author Share Posted November 13, 2008 Nope I still get the..Page ErrorThis page has been accessed in error...error when I click delete (it comes up when I go to the delete_comment.php file). Link to comment Share on other sites More sharing options...
jlhaslip Posted November 13, 2008 Share Posted November 13, 2008 Okay, wait for someone who knows OOPS to come along and figure out the correct code to add the id number into the delete link.Sorry that I am unable to finish this one for you. Link to comment Share on other sites More sharing options...
toxic27 Posted November 13, 2008 Author Share Posted November 13, 2008 It's alright man. Thanks for the help though, I know n00bs can be annoying, haha. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.