Jump to content

Ashoar

Members
  • Posts

    214
  • Joined

  • Last visited

    Never

Everything posted by Ashoar

  1. You could always use the PRINT function. Example: //IF statement goes here print "Type your error message in here";
  2. If you are referring to mine, no problem
  3. Which is my main problem I was hoping someone could show the better way of doing this.
  4. Try this, just update where it says so. <?php //Add database connection info here $info = $_GET['//database row name of info here']; $query = mysql_query("SELECT * FROM game WHERE //database row name of info here='$info' "); if (mysql_num_rows($query) == 0) { echo "No information found."; } else { $row = mysql_fetch_array($query); ?> Then to show the info: <?php echo($row['//database row name of info here']); ?>
  5. That gives an error fetching from the database.
  6. That is something i had tried, and even with a new field within the table. Yet when doing that the threads themselves didn't display and the posts wouldn't validate. I was hoping someone could add their method here or update my codes so that i could see exactly how it is done and see where i whent wrong when i had tried.
  7. Yes but each time i tried to do this it would not work, instead no threads were displayed and no posts were properly made. To add to that: The forums database and post database are 2 separate databases. So the forum id is in forums but i cannot make a post insert into that as that is only for the actual board id's.
  8. I am working on a small forum system at the moment but i have run into a small problem. A brief overview: I have an admin panel that allows you to create a board. This is then inserted into a MYSQL table called forums. Once the forum is made it is displayed on the index page of the forum. Each forum is given an ID. So if it was the first forum made it's id would be 1 etc. I have a page called board.php. This board contains the thread listings. The url for this is made up of the forum id that you clicked into. Example: /board.php?id=3 I have an individual page called post.php which allows you to make a post. My Problem: If i enter a board, let's say it's id is 2. If i make a post in that board i wan't that particular post to show only in that board. My problem is that if i make a post in any board, that post then shows up in every other board as well as the one it was posted into. So i need to find a way so that the post will show only in the board it is posted in. Here are the codes. Index.php: <?php include 'config.php'; print "<link rel='stylesheet' href='style.css' type='text/css'>"; print "<table class='maintable'>"; print "<tr class='headline'><td width=75%>Board</td><td>Posts</td><td>Last post</td></tr>"; $info="SELECT * from post_reply where parentid='0' order by lastrepliedto DESC"; $info2=mysql_query($info) or die("Could not get threads"); while($info3=mysql_fetch_array($info2)) { $info3[title]=strip_tags($info3[title]); $info3[author]=strip_tags($info3[author]); $boards = mysql_query("SELECT forum_name, forum_desc, forum_id FROM forums") or die(mysql_error()); $boards2 = mysql_num_rows($boards); for($count = 1; $count <= $boards2; $count++) { $name = mysql_fetch_array($boards); print "<tr class='mainrow'><td><A href='board.php?id=$name[forum_id]'>$name[forum_name]</a><p>$name[forum_desc</p></td> <td>$info3[numreplies]</td><td>$info3[showtime]<br>Last post by <b>$info3[lastposter]</b></td></tr>"; } print "</table>"; } ?> This is board.php <?php include "config.php"; print "<link rel='stylesheet' href='style.css' type='text/css'>"; print "<A href='post.php'>New Topic</a><br>"; print "<table class='maintable'>"; print "<tr class='headline'><td width=50%>Topic</td><td width=20%>Author/td><td>Replies</td><td>Last reply</td></tr>"; $info="SELECT * from post_reply where parentid='0' order by lastrepliedto DESC"; $info2=mysql_query($info) or die("Could not get threads"); while($info3=mysql_fetch_array($info2)) { $info3[title]=strip_tags($info3[title]); $info3[author]=strip_tags($info3[author]); print "<tr class='mainrow'><td><A href='message.php?id=$info3[postid]'>$info3[title]</a></td><td>$info3[author</td <td>$info3[numreplies]</td><td>$info3[showtime]<br>Last post by <b>$info3[lastposter]</b></td></tr>"; } print "</table>"; ?> And this is post.php <?php include "config.php"; if(isset($_POST['submit'])) { $name=$_POST['name']; $yourpost=$_POST['yourpost']; $subject=$_POST['subject']; if(strlen($name)<1) { print "You did not type in a name."; } else if(strlen($yourpost)<1) { print "You did not type in a post."; } else if(strlen($subject)<1) { print "You did not enter a subject."; } else { $thedate=date("U"); $displaytime=date("F j, Y, g:i a"); $subject=strip_tags($subject); $name=strip_tags($name); $yourpost=strip_tags($yourpost); $insertpost="INSERT INTO post_reply(author,title,post,showtime,realtime,lastposter) values('$name','$subject','$yourpost','$displaytime','$thedate','$name')"; mysql_query($insertpost) or die("Could not insert post"); print "Message posted, go back to <A href='index.php'>Forum</a>."; } } else { print "<form action='post.php' method='post'>"; print "Your name:<br>"; print "<input type='text' name='name' size='20'><br>"; print "Subject:<br>"; print "<input type='text' name='subject' size='20'><br>"; print "Your message:<br>"; print "<textarea name='yourpost' rows='5' cols='40'></textarea><br>"; print "<input type='submit' name='submit' value='submit'></form>"; } print "</td></tr></table>"; ?> So would someone be able to look through the coding and possibly provide a fix to this. Thanks
  9. Bump. Anyone know what the problem could be now
  10. Well no errors that time, but i tested it. Sent a pm from 1 user 2 another, but it did not work, didnt say they they had a new message.
  11. Ah thanks. An error shows up with that Parse error: syntax error, unexpected '>' in /home/a4588739/public_html/inbox.php on line 34 which is this line: echo "<p>You have new messages</p>";
  12. Thats why i asked, so you could show how to do it
  13. Yep that was better. And under that do i need to put something like: if (newmsg='1') <p><?php echo "You have new messages" ?></p> so that it says if you have a new message or not, because adding that give another error
  14. This 1 you said SELECT COUNT(id) AS `newmessages` FROM messages WHERE received='$user' && newmsg=1
  15. Have a problem, with that piece of code in i get this error. Parse error: syntax error, unexpected T_STRING in /home/a4588739/public_html/inbox.php on line 31
  16. Ok ill try it out now. Also is this correct for the database field? `newmsg` enum('1','0') NOT NULL default '1',
  17. Ok yeah i understand that part
  18. The newmsg field on the database is Default 1. So yes
  19. Could you show me how Really unsure of how i am to do that
  20. I can do that part, but shouldnt i need to add something to the php code so that the database field knows when a message is recieved? Because at the moment there is nothing in the code with the name newmsg
  21. Update. Ok i have updated the database with the new field. Now going back to the php inbox code, what exactly do i need to add to it so that it knows of the new messages and allows me to echo a notification> The new field name is, newmsg
  22. Ok thanks ill add it in and test it out and let you know the results.
  23. Yeah sure. CREATE TABLE `messages` ( `id` int(11) NOT NULL auto_increment, `reciever` varchar(25) NOT NULL default '', `sender` varchar(25) NOT NULL default '', `subject` text NOT NULL, `message` longtext NOT NULL, `recieved` enum('0','1') NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
  24. I have my private message inbox code code here. At the moment when you recieve a message you dont get a notification, you have to manually go into the inbox and find the new message. I cant figure it out, could someone help me show unread and read messages and how to add a notification when you recieve a new message so that i can add the new message notification to the members profile page. <?php session_start(); require_once("header.php"); $user = $_SESSION['username']; include 'db.php'; if(!$user) { echo "<br><p>You arent logged in, Please login or Register</p><br>"; } else { $sql = mysql_query ("SELECT pm_count FROM members WHERE username='$user'"); $row = mysql_fetch_array ($sql); $pm_count = $row['pm_count']; $percent = $pm_count/'50'; $percent = $percent * '100'; ?> <br> <center> <b><p><a href="inbox.php">Inbox</a> | <a href="compose.php">Compose</a> | <a href="sent.php">Sentbox</a></b> <b><p><?php echo "$pm_count"." of 50 Total | "."$percent"."% full"; ?></p></b> </center> <br> <?php $query = "SELECT id, sender, subject, message FROM messages WHERE reciever='$user'"; $sqlinbox = mysql_query($query); if(!$sqlinbox) { ?> <p><?php print '$query: '.$query.mysql_error();?></p> <?php } elseif (!mysql_num_rows($sqlinbox) ) { ?> <center><p><b>You have no messages to display</b></p></center> <?php } else { ?> <center> <form name="send" method="post" action="delete.php"> <table width="80%"> <tr> <td width="75%" valign="top"><p><b><u>Subject</u></b></p></td> <td width="120px" valign="top"><p><b><u>Sender</u></b></p></td> <td width="25px" valign="top"><p><b><u>Select</u></b></p></td> </tr> <?php while($inbox = mysql_fetch_array($sqlinbox)) { $pm_id = $inbox['id']; $sender = $inbox['sender']; $subject = $inbox['subject']; ?> <tr> <td width="75%" valign="top"><p><a href="viewmsg.php?msg_id=<?php echo $pm_id; ?>"><?php echo $subject; ?></a></p></td> <td width="120px" valign="top"><p><?php echo $sender; ?></p></td> <td width="25px" valign="top"><input name="pms[]" type="checkbox" value="<?php echo $pm_id; ?>"></td> </tr> <?php } ?> <tr> <td colspan="3"><input type="submit" name="Submit" value="Delete Selected"></td> <td></td> <td></td> </tr> </table> </center> <?php } } require_once("footer.php"); ?> Thanks
×
×
  • 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.