Jump to content

knnakai

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by knnakai

  1. The name of the file is showtopic.php Its not really an error it just open the topiclist.php, ignoring the rest of the code.
  2. :-\ I can't find where and why it only see the first 6 lines executing the topiclist.php not going Thu the code? Please any suggestion?? hesre is the code: <?php //check for required information from the query string if ( !isset( $_GET["topic_id"])) { header("Location: topiclist.php"); exit; } //connect to server $mysqli = mysqli_connect("localhost", "root", "root", "test"); //verify the topic exists $verify_topic_sql = "SELECT topic_title FROM forum_topics WHERE topic_id = '".$_GET["topic_id"]."'"; $verify_topic_res = mysqli_query($mysqli, $verify_topic_sql) or die(mysqli_error($mysqli)); if (mysqli_num_rows($verify_topic_res) < 1 ) { //this topic doens not exist $display_block = "<p><em>You have selected an invalid topic.<br/> Please <a href=\"topiclist.php\">Try again</a>.</em></p>"; } else { //get the topic title while ($topic_info = mysqli_fetch_array ( $verify_topic_res)) { $topic_title = stripslashes($topic_info['topic_title']); } //gether the posts $get_posts_sql = "SELECT post_id, post_text DATE_FORMAT(post_create_time, '%b %e %Y at %r') AS fmt_post_create_time, post_owner FROM forum_posts WHERE topic_id = '".$_GET["topic_id"]."' ORDER BY post_create_time ASC"; $get_posts_res = mysqli_query($mysqli, $get_posts_sql) or die(mysqli_error($mysqli)); //create the display string $display_block = " <p>Showing posts for the <strong>".$topic_title."</strong> Topic:</p> <table width=\"100%\" cellpadding=\"3\" cellspacing=\"1\" border=\"1\"> <tr> <th>AUTHOR</th> <th>POST</th> </tr>"; while ($posts_info = mysqli_fetch_array($get_posts_res)) { $post_id = $posts_info['post_id']; $post_text = nl2br(stripslashes($posts_info['post_text'])); $post_create_time = $posts_info['fmt_post_create_time']; $post_owner = stripslashes($posts_info['post_owner']); //aad to display $display_block .= " <tr> <td width=\"35%\" valign=\"top\">".$post_owner."<br/> [".$post_create_time."]</td> <td width=\"65%\" valign=\"top\">".$post_text."<br/><br/> <a href=\"replaytopost.php?post_id=".$post_id."\"> <strong>REPLAY TO POST</strong></a></td> </tr>"; } //free result mysqli_free_result($get_posts_res); mysqli_free_result($verify_topic_res); //close connection to MySQL mysqli_close($mysqli); //Close up table $display_block .= "</table>"; } ?> <html> <head> <title>Posts in Topic</title> </head> <body> <h1>Posts in Topic</h1> <?php echo $display_block; ?> </body> </html>
  3. Cool it works fine. Thanx a lot.
  4. I don't really know what is wrong with the code it shows this error message? Could anybody help? (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id = '3'' at line 1) the code is: <?php $mysqli = mysqli_connect("localhost", "root", "root", "test"); if (!$_POST) { //Show the selected form $display_block = "<h1>Select an Entry</h1>"; //get parts of recordes $get_list_sql ="SELECT id, CONCAT_WS(', ', l_name, f_name) AS display_name FROM master_name ORDER BY l_name, f_name"; $get_list_res =mysqli_query($mysqli, $get_list_sql) or die(mysqli_error($mysqli)); if (mysqli_num_rows($get_list_res) < 1) { //No records $display_block .= "<p><em>Sorry, no recordes to select!</em></p>"; } else { //Has result, get result and print in a form $display_block .= " <form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\"> <p><strong>Select a Record to Delete:</strong><br/> <select name=\"sel_id\"> <option value=\"\">-- Select One --</option>"; while ($recs = mysqli_fetch_array($get_list_res)) { $id = $recs['id']; $display_name = stripslashes($recs["display_name"]); $display_block .= "<option value=\"".$id."\">". $display_name."</option>"; } $display_block .= " </select> <p><input type=\"submit\" name=\"submit\" value=\"Delete Selected Entry\"></p> </form>"; } // free result mysqli_free_result($get_list_res); } else if ($_POST) { //check for required field if ($_POST["sel_id"] == "") { header("Location: delentry.php"); exit; } //issue queries $del_master_sql = "DELETE FROM master_name, WHERE id = '".$_POST["sel_id"]."'"; $del_master_res = mysqli_query($mysqli, $del_master_sql) or die (mysqli_error($mysqli)); $del_address_sql = "DELETE FROM address WHERE id = '".$_POST["sel_id"]."'"; $del_address_res = mysqli_query($mysqli, $del_address_sql) or die(mysqli_error($myslqi)); $del_tel_sql = "DELETE FROM telephone WHERE id ='".$_POST["sel_id"]."'"; $del_tel_res = mysqli_query($mysqli, $del_tel_sql) or die(mysqli_error($mysqli)); $del_fax_sql = "DELETE FROM fax WHERE id = '".$_POST["sel_id"]."'"; $del_fax_res = mysqli_query($mysqli, $del_fax_sql) or die(mysqli_error($mysqli)); $del_email_sql = "DELETE FROM email WHERE id = '".$_POST["sel_id"]."'"; $del_email_res = mysqli_query($mysqli, $del_email_sql) or die(mysqli_error($mysqli)); $del_note_sql = "DELETE FROM personal_notes WHERE id = '".$_POST["sel_id"]."'"; $del_note_res = mysqli_query($mysqli, $del_note_sql) or die(mysqli_error($mysqli)); $display_block = "<h1>Recod (s) Deleted</h1> <p>Would you like to <a href=\"".$_SERVER["PHP_SELF"]."\">Delete another</a>?</p>"; } ?> <html> <head> <title>My Records</title> </head> <body> <?php echo $display_block; ?> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.