PHP - Forum Trouble?
Is it just me or is anyone else having problems with the site?
When I make a reply to a post and submit it, my post is added but it also appears as an edit window still below my just-posted post. Also - when I try and edit my post the edit window opens up but the text of my post flashes by and does not show. If I re-type the entire post with my edits and save it, the edits do not appear. This has been happening for 3-4 days now. Edited by ginerjm, 30 December 2014 - 01:33 PM. Similar TutorialsHello all,
I am working on my own PHP project where I can build myself my own forum just like how this site functions.
I would like to have user accounts and when you log in have a list of bulletin topics that you can choose from and then post your own question or topic and then other users can go to your post and write answers to it. I know there are many forums out there that you can make and set up to use but I would like to have my own so I can customize it any way I want.
Could I get some ideas on where I should start with this. I have been working on a website with a login functionality and I almost have that set up, then my next steps will be making it so users will be able to post topics.
I been doing google research trying to get some tutorials on this but I haven’t found one that is much help. I will be using phpmyadmin database and I plan on writing my sql as mysqli.
Thank you.
Hello everybody, am a bit new here. My question is, if I am on the right place here? I feel like been in the wrong place. Am looking for some forum where I can ask or find about "General questions" I have about PHP sometimes. Am not sure, if I am on the right "Forum" or if this is the "right category" Thank u! I need to figure out how to give this input a name so when i submit it i can get the data from it.
<!doctype html> <html> <head> <meta charset="utf-8"> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" type="text/css" rel="stylesheet"/> <style> input{font-size:1.3em;} #log{position: absolute; top: 10px; right: 10px;} span{color:blue; text-decoration: underline; cursor: pointer;} </style> </head> <body> <div id="inputs"></div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" type="text/javascript"></script> <script src="jquery.googleSuggest.js" type="text/javascript"></script> <script> $.each("web".split(" "), function(i, v){ var div = $("<div>").appendTo("#inputs") , input = $("<input>").appendTo(div) , span = $("<label>").text(v).appendTo(div); input.googleSuggest({ service: v }); }); </script> </body> </html> Okay I am making a forum and it is almost finished. The only thing is, I am stuck on how to get the most updated topics to appear at the top of the list. Like on every forum there is a new forum post that you havent visited yet. They are at the top of the list. How would I do that??? Site Name: Forum Pioneer Link to site: http://forumpioneer.com/ (Down Currently) Positions Available: 2 Admin Super and Normal Moderators phpBB Support Team MyBB Support Team IPB Support Team vBulletin Support Team XenForo Support Team Forum Pioneer is a resource site and webmasters central for forum software. I intend for it to be a collection of the best and the most useful modifications that forum owners need. Pm me for more info. We are currently on phpBB, but I intend to migrate to IPB when the forum gets bigger. Hello im using mybb forum, and i have another webpage what i want to access with forum username and password. Dont know how to make it work.
we have a hacker on my forum using -1424 values as inputs how do i block and make sure the input is not anything negative? here is my code which is supposed to return all forums from the database and then display them in their respective categories. however it only shows one of the forums and not all of them. Anyone know why? function display_forum_list($crumbs) { global $link, $template, $settings, $lang, $config, $user; $template->replace( array( '{CRUMBS}' => display_crumbs($crumbs) ), 'index_page'); $query = $link->query("SELECT * FROM ".TBL_PREFIX."forums ORDER BY f_lid ASC"); $result = $query->fetchAll(); foreach($result as $key => $val) { if($result[$key]['f_pid'] == 0) { $cat_name = $result[$key]['f_name']; } else { $forum_name = $result[$key]['f_name']; } $forum_desc = $result[$key]['f_description']; } $template->replace( array( '{CATEGORY}' => $cat_name, '{F_ICON}' => '', '{F_NAME}' => $forum_name, '{F_DESC}' => $forum_desc, '{SITE_ROOT}' => $config['asf_root'] ), 'forum_list'); } Hello! I can't manage to get my forum to work. When I want a new topic to be made I got some code I will show in a second. But I just keep getting my own error message that just shows me something is wrong ... please help me figure it out. Hello! My problem is that in my forum I want to display the picutre of their user and if they do not have a picture I want to show the standard one. I got all of this working on another part of the page but for some reason I can only get it to display the standard picture and not their custom picture... The code looks like this: Code: [Select] <?php // Now query any responses out of the database and place in a dynamic list $sqll = mysql_query("SELECT id FROM myMembers"); while($row = mysql_fetch_array($sqll)){ $id = $row["id"]; $check_pic = "..//members/$id/image01.jpg"; $default_pic = "..//members/0/image01.jpg"; if (file_exists($check_pic)) { $user_pic = "<img src=\"$check_pic\" align=\"left\" width=\"80px\" border=\"0\" />"; // forces picture to be 120px wide and no more } else { $user_pic = "<img src=\"$default_pic\" align=\"left\" width=\"80px\" border=\"0\" />"; // forces default picture to be 120px wide and no more } } $all_responses = ""; $sql = mysql_query("SELECT * FROM forum_posts WHERE otid='$thread_id' AND type='b'"); $numRows = mysql_num_rows($sql); if ($numRows < 1) { $all_responses = '<div id="none_yet_div">No respond has been posted yet.</div>'; } else { while($row = mysql_fetch_array($sql)){ $reply_author = $row["post_author"]; $reply_author_id = $row["post_author_id"]; $date_n_time = $row["date_time"]; $convertedTime = ($myAgoObject -> convert_datetime($date_n_time)); $whenReply = ($myAgoObject -> makeAgo($convertedTime)); $reply_body = $row["post_body"]; $all_responses .= '<div class="response_top_div"> ' . $thread_title . ' | ' . $whenReply . ' <a href="../profile.php?id=' . $reply_author_id . '">' . $reply_author . '</a> said:</div> <div class="response_div" style="padding-left:20px; vertical-align:text-top;">' . $user_pic . ' <div style="padding-left:117px;"> ' . $reply_body . '</div></div>'; } } ?> Please help me if you can! Thank you! Hi can anyone help this is my forum reply code: <?php include "connect.php"; // Get value of id that sent from hidden field $id=$_POST['id']; // Find highest answer number. $sql="SELECT MAX(a_id) AS Maxa_id FROM reply WHERE question_id='$id'"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); // add + 1 to highest answer number and keep it in variable name "$Max_id". if there no answer yet set it = 1 if ($rows) { $Max_id = $rows['Maxa_id']+1; } else { $Max_id = 1; } // get values that sent from form $a_name=$_POST['a_username']; $a_answer=$_POST['a_reply']; // Insert answer $sql2="INSERT INTO reply(question_id, a_id, a_username, a_reply, a_date, a_time)VALUES('$id', '$Max_id', '$a_username', '$a_reply', CURDATE(), CURTIME())"; $result2=mysql_query($sql2); if($result2){ echo "Successful<BR>"; echo "<a href='viewtopic.php?id=".$id."'>View your answer</a>"; // If added new answer, add value +1 in reply column $sql3="UPDATE topic SET reply='$Max_id' WHERE id='$id'"; $result3=mysql_query($sql3); } else { echo "ERROR"; } mysql_close(); ?> and this is the error message anyone know why it gives this Thanks Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/fightwa1/public_html/addreply.php on line 10 please help Whats is the best way to create a forum using php? Should I use any frameworks? If not is there any guide/tutorial/book that descibe this procedure? Thank you. Just a general question, but could someone help me and tell me how to allow the user to enter a <br> without actually typing it. Like when they're typing in the forums, I want it to automatically go on a new line when they hit the ENTER key. Or could someone lead me to a guide? I tried searching everywhere and just can't seem to find it. Hey so I've been designing a custom forum script and I need help. I'm trying to create a breadcrumb that takes into account page title. My pages have an id, so for example: threadlist.php?id=1, viewthread.php?id=3 and so on. I used a tutorial to get started.This is what I have so far. This portion is in header.php to get session: $url =BASE_URL; $_SESSION['history'][$title] = $url; while(count($_SESSION['history']) > 4) array_shift($_SESSION['history']);
breadcrumbs.php <div class="container pagination"> <nav aria-label="breadcrumb"> <ol class="breadcrumb"> <?php foreach($_SESSION['history'] as $title => $url) { echo "<li class='breadcrumb-item'><a href=". $url .">". $title ."</a></li>"; } ?> </ol> </nav> </div> It works decently well. Only problem is, when I go back to the homepage, or backwards, it doesn't remove the breadcrumb. Also, I can't click on the breadcrumb because the url isn't set up right. I know I have it set to BASE_URL buts that's only cause I can't figure out how to grab the url which would be different for every section of the site I'm on. Lets say I have a simple table for Categories; fid forum desc cat 1 General Forum desc here 1 2 Help Forum desc here 2 3 Console Forum desc here 3 Hello! I think I need some creative juice to start my flow and am thankful for any suggestions. I am looking into some advice on how to code in "Category" wise. Lets say if I have forums like this; General Forum Quote General Talk about anything in general to NewbWorld. Suggestions Have any ideas to give to NewbWorld? Anything Goes Talk about anything you want! Help Forum Quote HTML Help If you are having problems with HTML coding post here! PHP Help If you are having problems with PHP coding post here! Instead of me manually coding each Category (General Forum, Help Forum, Console Forum, etc)... I want to be able to have the following coded like so; List Category ---Forum Sub Category ---Forum Sub Category ---Forum Sub Category List Category 2 ---Forum Sub Category ---Forum Sub Category ---Forum Sub Category Right now; I've been coding the "List Category" manually to show "Sub Forums". I would like to know how to do this without manual anymore. I would love to start coding an admin/moderator panel soon. Any help is much appreciated and thankyou for your time! Hi, I am implementing a forum in php and mysql. I want to close forum questions / posts automatically after four days of posting. How to implement this ? Please help me. Thanks in advance. Hey! So, I don't know if this is the current section, couldn't really decide on what section/board to post it, so ..
I've got a code that I got from a friend of mine (it was a gaming website (a game server), but he shut it down, I asked for some scripts, he sent me the whole site ..). I got all other scripts correctly, but I do not know how to get this Last Forum Posts to work (IP.Board). I've got the SEO set up as it should and everything, doesn't work.
When I use this
<?php $_handlerForum = new mysql("Forum","localhost","*********_fqipb2","*********_fqipb2","password"); $topics = $_handlerForum->fetch("SELECT `tid`,`title`,`last_post`,`title_seo`,`last_poster_name` FROM `topics` ORDER BY `last_post` DESC LIMIT 0,3;",array()); $content = ""; foreach($topics as $topic) { $content .= "<a href='http://website.com/forum/index.php?/topic/".$topic['tid']."-".$topic['title_seo']."' target='_blank'>".$topic['title']."</a><br /> <small class='dim'>".$topic['last_poster_name']." - ".date("H:i F d, Y",$topic['last_post'])."</small><hr style='margin: 5px 0px;' />"; } return $content; return "Under Construction"; ?>I get this error Fatal error: Class 'mysql' not found in /home/***/***/***/public_html/extra/forum.php on line 2Thought that the problem was "new mysql" (on line 2), so I put in mysql_connect, still get an error. Can anyone help? Hi Guys, I should know how to do this but for some reason my code isn't working or I just am missing something... I am setting up a simple forum and posts are stored in one table with the following fields: auto_id -------- primary, auto_increment start -------- stores a 0 or 1, to show that the post is the first in the thread. (1 for the starting post, 0 for other posts in the thread) blog_id ---------- the threads id number, posts that are repllies to the starting post have the same blog_id number. bid ---------- forum title title ----------- post title post_by --------- user's profile name mem_id ---------user's member id date_time --------- the date and time querydate --------- unix timestamp visible ------------ to disable visibility of a specific post My Problem is that I can list posts in certain forum but when someone creates another post in an older thread, I want that thread to show up at the top of the list of threads, but my code isn't doing it.... Example: A) Who bought the new iPhone 4S? Started by: John - Date: February 1, 2011 What did you think of the Green Lantern Movie? Started by: Mary - Date: January 1, 2011 **then if someone adds a post to "Going to see Transformers tonight." that thread should show up above the "Who bought new iPhone 4S?" thread, just basically like any forum page... B) What did you think of the Green Lantern Movie? (New Post Added on: March 1, 2011 by Scott) Started by: Mary - Date: January 1, 2011 Who bought the new iPhone 4S? Started by: John - Date: February 1, 2011 Here is my while loop code so far: Code: [Select] $sqlf="SELECT * FROM blogs WHERE bid='$brd' AND visible='yes' GROUP BY blog_id ORDER BY querydate DESC, auto_id DESC "; $rsf=mysql_query($sqlf); ..... Some HTML and CSS while($rowf=mysql_fetch_array($rsf)) { ..... Some more HTML/CSS and displaying the variables for the rows of threads. } Thanks for any help... Im struggling with this pagination part of the replies of the forum it looks to be the final part! Heres the code: Code: [Select] <?php include 'connect.php'; // get value of id that sent from address bar $id=$_GET['id']; $sql="SELECT * FROM topic WHERE id='$id'"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); // find out how many rows are in the table $sql = "SELECT COUNT(*) FROM reply"; $result = mysql_query($sql) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r[0]; // number of rows to show per page $rowsperpage = 10; // find out total pages $totalpages = ceil($numrows / $rowsperpage); // get the current page or set a default if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { // cast var as int $currentpage = (int) $_GET['currentpage']; } else { // default page num $currentpage = 1; } // end if // if current page is greater than total pages... if ($currentpage > $totalpages) { // set current page to last page $currentpage = $totalpages; } // end if // if current page is less than first page... if ($currentpage < 1) { // set current page to first page $currentpage = 1; } // end if // the offset of the list, based on current page $offset = ($currentpage - 1) * $rowsperpage; ?> <table width='800' border='0' align='center' cellpadding='10'> <tr> <td width='20' height='50' align='center' bgcolor='#990000'><font color='#FFFFFF'><b>ID</b></font></td><td width='200' height='50' align='center' bgcolor='#990000'><font color='#FFFFFF'><b>Username:<br />Date & Time:</b></font></td><td align='center' bgcolor='#990000'><font color='#FFFFFF'><b>Topic & Message:</b></font></td> </tr> <tr> <td height='50' align='center' valign='top' bgcolor='#AAAAAA'></td> <td height='50' align='center' valign='top' bgcolor='#AAAAAA'><b><? echo $rows['username']; ?></b><br /><? echo $rows['date']; ?><br /><? echo $rows['time']; ?></td> <td height='50' align='center' bgcolor='#AAAAAA'><b><a href="viewtopic.php?id=<? echo $rows['id']; ?>"><? echo $rows['topic']; ?></a></b></td> </tr> <tr> <td height='50' align='center' bgcolor='#AAAAAA' colspan='3'><? echo $rows['detail']; ?></td> </tr> <tr> <td></td> </tr> <?php $sql2 = "SELECT * FROM reply WHERE reply_id='$id' LIMIT $offset, $rowsperpage"; $result2 = mysql_query($sql2) or trigger_error("SQL", E_USER_ERROR); while($rows=mysql_fetch_array($result2)){ ?> <tr> <td height='50' align='center' valign='top' bgcolor='#AAAAAA'><b><? echo $rows['a_id']; ?></b></td> <td height='50' align='center' valign='top' bgcolor='#AAAAAA'><b><? echo $rows['a_username']; ?></b><br /><? echo $rows['a_date']; ?><br /><? echo $rows['a_time']; ?></td> <td height='50' align='center' bgcolor='#AAAAAA'><? echo $rows['a_reply']; ?></td> </tr> <? } ?> </table> <br /> <BR> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form name="form" method="post" action="addreply.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td valign="top"><strong>Reply</strong></td> <td valign="top">:</td> <td><textarea name="a_reply" cols="45" rows="3"></textarea></td> </tr> <tr> <td> </td> <td><input name="id" type="hidden" value="<? echo $id; ?>"></td> <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Reset" value="Reset"></td> </tr> </table> </td> </form> </tr> </table> <?php /****** build the pagination links ******/ // range of num links to show $range = 3; // if not on page 1, don't show back links if ($currentpage > 1) { // show << link to go back to page 1 echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'>First</a> "; // get previous page num $prevpage = $currentpage - 1; echo " - "; // show < link to go back to 1 page echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'>Previous</a> "; } // end if // loop to show links to range of pages around current page for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $totalpages)) { // if we're on current page... if ($x == $currentpage) { // 'highlight' it but don't make a link echo " [<b>$x</b>] "; // if not current page... } else { // make it a link echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> "; } // end else } // end if } // end for // if not on last page, show forward and last page links if ($currentpage != $totalpages) { // get next page $nextpage = $currentpage + 1; // echo forward link for next page echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>Next</a> "; echo " - "; // echo forward link for lastpage echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>Last</a> "; } // end if /****** end build pagination links ******/ ?> When I click next page or any link it goes to the table but blank page. I have also added '?id=$id' before ?currentpage on the link but this just doubles up the ?currentpage on the address page. Please help im really struggling! Thanks |