Hi budd
Im trying to make a forum work but i cant and so far i have been able to fix sow the topis and all the info gets in to the mysql
no is the problem to see it.....
I get this error when i gonna see the post text
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Apache Group\Apache2\htdocs\Flameline\functions.php on line 28
here are the function.php skript...
Sorry fore the load of code but i hop if you see all of the code it might help some more...
<?php
mysql_connect("localhost","*","");
mysql_select_db("flameline");
function showheader($title) {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE> <?php echo $title ?> </TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<?php
}
function showfooter() {
?>
</BODY>
</HTML>
<?php
}
function viewpost ($topicID) {
$topic_query = mysql_query("SELECT topicname FROM topics WHERE (ID=$topicID)");
$topic = mysql_fetch_array($topic_query);
?>
<TABLE BORDER=0 WIDTH=100% CELLSPACING=3 CELLPADDING=5>
<TR>
<TD>
<FONT COLOR="#000000" FACE="Arial,Verdana,Helvetica" size=-1>
<b>Topic: </b>
<BR><?php echo $topic['TopicName'] ?>
<P>
<a href="index.php"><FONT COLOR="#000000">Return Back to Topic Listing</a>
<P>
<a href="add-post.php?topicID=<?php echo $topicID ?>"><FONT COLOR="#000000">Make a Post</a>
</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%>
<TR VALIGN=TOP ALIGN=LEFT>
<TD WIDTH=100%>
<TABLE BORDER=0 BGCOLOR="#000000" CELLSPACING=1 CELLPADDING=1 WIDTH=100%>
<TR>
<TD COLSPAN=3 BGCOLOR="#C0C0C0" WIDTH=100%>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=100%>
<TR>
<TD>
<P><B><FONT COLOR="#000000" FACE="Trebuchet MS,Arial,Helvetica">Topic Posts</FONT></B>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<?php
$post_query = mysql_query("SELECT * FROM posts WHERE (TopicID='$topicID') ORDER BY TimeStamp");
while ($post = mysql_fetch_array($post_query)) {
?>
<TR>
<TD WIDTH=82% BGCOLOR="#FFFFFF" HEIGHT=28 VALIGN=TOP>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=100%>
<TR>
<TD>
<P><FONT SIZE="-1" FACE="Trebuchet MS,Arial,Helvetica"><?php echo $post['Post'] ?></FONT>
</TD>
</TR>
</TABLE>
</TD>
<TD WIDTH=18% BGCOLOR="#C0C0C0" VALIGN=TOP>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=100% >
<TR>
<TD>
<P ALIGN=center><FONT SIZE="-1" FACE="Trebuchet MS,Arial,Helvetica" color=#000000>Posted By: <A HREF="mailto:<?php echo $post['Email'] ?>"> <FONT COLOR=#000000><?php echo $post['Name'] ?></A>
<BR><BR>
<A HREF="edit-post.php?postID=<?php echo $post['ID'] ?>"><FONT COLOR=#000000>Edit Your Post</FONT>
<BR><BR>
<A HREF="delete-post.php?postID=<?php echo $post['ID'] ?>"><FONT COLOR=#000000>Delete Your Post</FONT>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<?php
}
if (mysql_num_rows($post_query) < 1) {
?>
<TR height=300>
<TD WIDTH=100% BGCOLOR="#FFFFFF" HEIGHT=28 VALIGN=TOP colspan=2>
<CENTER><FONT SIZE="-1" FACE="Trebuchet MS,Arial,Helvetica">
<BR><B>There Are No Posts Currently For This Topic</B><BR><BR></CENTER>
</TD>
</TR>
<?php } ?>
</TABLE>
</TD></TR>
</TABLE>
<?php
}
function addpost () {
global $password,$email,$name,$post,$topicID;
$timestamp = time();
$new_password = addslashes($password); $new_email = addslashes($email);
$new_name = addslashes($name);
$new_post = addslashes(nl2br(htmlspecialchars($post)));
$insert = mysql_query("INSERT INTO posts VALUES ('NULL','$topicID','$new_name','$new_email','$new_password','$timestamp','$new_post')");
if (mysql_error() != "") {
showheader("MySQL Error ".mysql_error());
?>
<br><p><center><b>There was a MySQL Error -- <?php echo mysql_error() ?></b></center></p>
<?php
showfooter();
exit;
}
}
function editpost () {
global $postID,$post;
$new_post = addslashes(nl2br(htmlspecialchars($post)));
$insert = mysql_query("UPDATE posts SET post='$new_post' WHERE (ID='$postID')");
if (mysql_error() != "") {
showheader("MySQL Error ".mysql_error());
?>
<br><p><center><b><FONT SIZE="-1" FACE="Trebuchet MS,Arial,Helvetica">There was a MySQL Error -- <?php echo mysql_error() ?></b></center></p>
<?php
showfooter();
exit;
}
}
function deletepost () {
global $postID;
$post_query = mysql_query("DELETE FROM posts WHERE (ID='$postID')");
if (mysql_error() != "") {
showheader("MySQL Error ".mysql_error());
?>
<br><p><center><b><FONT SIZE="-1" FACE="Trebuchet MS,Arial,Helvetica">There was a MySQL Error -- <?php echo mysql_error() ?></b></center></p>
<?php
showfooter();
exit;
}
}
function addtopic () {
global $topicname;
$new_topicname = addslashes($topicname);
$topic_query = mysql_query("INSERT INTO topics VALUES ('NULL','$new_topicname')");
if (mysql_error() != "") {
showheader("MySQL Error ".mysql_error());
?>
<br><p><center><b><FONT SIZE="-1" FACE="Trebuchet MS,Arial,Helvetica">There was a MySQL Error -- <?php echo mysql_error() ?></b></center></p>
<?php
showfooter();
exit;
}
return mysql_insert_id();
}
?>
Here are the view.php
<?
require( './functions.php');
viewpost($topicID);
?>
I Now that sysop dont like the code bang but if some sysof see the ihop that thay understand..