Jump to content

[SOLVED] Grabing From Row "Custom Forums"


Stotty

Recommended Posts

Well ive made some custom forums, http://fateorfantasy.exofire.net/board/message.php?id=1 Direct Link

 

It should say in your header broser title

PHP Freaks Help - Cetoxis Forums seen as thats the thread name

 

But it is Printing Resource id #3

 

If You could help i would love that here is my full code for message.php "need more info [email protected]" is my msn

 

  <?php 

include "connect.php"; //mysql db connection here

$title = "SELECT title
FROM forumtutorial_posts";
$title=mysql_query($title)
?>
<html>
<head>
<title><?php echo $title; ?> - Cetoxis Boards</title>
</head>
<body>
<?php
$id=$_GET['id'];

print "<link rel='stylesheet' href='style.css' type='text/css'>";

print "<A href='index.php'>Back to main forum</a>-<A href='post.php'>New Topic</a>-<A href='reply.php?id=$id'>Reply<br>";

print "<table class='maintable'>";

print "<tr class='headline'><td width=20%>Author</td><td width=80%>Post</td></tr>";

$gettopic="SELECT * from forumtutorial_posts where postid='$id'";

$gettopic2=mysql_query($gettopic) or die("Could not get topic");

$gettopic3=mysql_fetch_array($gettopic2);

print "<tr class='mainrow'><td valign='top'>$gettopic3[author]</td><td vakign='top'>Last replied to at $gettopic3[showtime]<br><hr>";

$message=strip_tags($gettopic3['post']);

$message=nl2br($message);

print "$message<hr><br>";

print "</td></tr>";

$getreplies="Select * from forumtutorial_posts where parentid='$id' order by postid desc"; //getting replies

$getreplies2=mysql_query($getreplies) or die("Could not get replies");

while($getreplies3=mysql_fetch_array($getreplies2))

{

   print "<tr class='mainrow'><td valign='top'>$getreplies3[author]</td><td vakign='top'>Last replied to at $getreplies3[showtime]<br><hr>";

   $message=strip_tags($getreplies3['post']);

   $message=nl2br($message);

   print "$message<hr><br>";

   print "</td></tr>";

}

print "</table>";



?>  
</p>
<p align="right">Powered By Cole</p>
</body>
</html>

 

Thanks in Advanced

Link to comment
https://forums.phpfreaks.com/topic/132924-solved-grabing-from-row-custom-forums/
Share on other sites

<?php 

include "connect.php"; //mysql db connection here

$sql = "SELECT title FROM forumtutorial_posts";
$result = mysql_query($sql) or die(mysql_error());
$title = mysql_fetch_row($result);
echo '<title>'.$title[0].' - Cetoxis Boards</title>';
?>

this assumes that the desired title is the first row in forumtutorial_posts.

My Database Setup

 

CREATE TABLE forumtutorial_posts (

  postid bigint(20) NOT NULL auto_increment,

  author varchar(255) NOT NULL default '',

  title varchar(255) NOT NULL default '',

  post mediumtext NOT NULL,

  showtime varchar(255) NOT NULL default '',

  realtime bigint(20) NOT NULL default '0',

  lastposter varchar(255) NOT NULL default '',

  numreplies bigint(20) NOT NULL default '0',

  parentid bigint(20) NOT NULL default '0',

  lastrepliedto bigint(20) NOT NULL default '0',

  PRIMARY KEY  (postid)

)

<?php 

include "connect.php"; //mysql db connection here

$sql = "SELECT title FROM forumtutorial_posts WHERE postid=".$_GET['id'];
$result = mysql_query($sql) or die(mysql_error());
$title = mysql_fetch_row($result);
echo '<title>'.$title[0].' - Cetoxis Boards</title>';
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.