runnerjp Posted May 30, 2008 Share Posted May 30, 2008 for some reason my message part of my forum has all of a sudden decided not to post the id of the thread into parentid :S <?php session_start(); //connection string require_once '../settings.php'; include "connect.php"; $id = $_SESSION['user_id']; $query = "SELECT * FROM users WHERE ID = '$id' LIMIT 1"; if ($result = mysql_query($query)){ if (mysql_num_rows($result)) { $array = mysql_fetch_assoc($result); $puser = $array['Username']; $pimage = $array['image']; ?> <link rel='stylesheet' href='style.css' type='text/css'> <table class='maintables'> <tr class='headline'><td>Reply</td></tr> <tr class='maintables'><td> <?php if(isset($_POST['submit'])) { $name=$puser; $yourpost=$_POST['yourpost']; $subject=$_POST['subject']; $id=$_POST['id']; if(strlen($yourpost)<1) { print "You did not type in a post."; //no post entered } else { $thedate=date("U"); //get unix timestamp $displaytime=date("F j, Y, g:i a"); //we now strip HTML injections $subject=strip_tags($subject); $name=strip_tags($name); $yourpost=strip_tags($yourpost); $insertpost="INSERT INTO forumtutorial_posts(author,title,post,showtime,realtime,lastposter,parentid) values('$name','$subject','$yourpost','$displaytime','$thedate','$name','$id')"; mysql_query($insertpost) or die("Could not insert post"); //insert post $updatepost="Update forumtutorial_posts set numreplies=numreplies+'1', lastposter='$name',showtime='$displaytime', lastrepliedto='$thedate' where postid='$id'"; mysql_query($updatepost) or die("Could not update post"); print "Message posted, go back to <A href='index.php?page=message&id=$id'>Message</a>."; } } else { $gettopic="SELECT * from forumtutorial_posts where postid='$id'"; $gettopic2=mysql_query($gettopic) or die("Could not get topic"); $gettopic3=mysql_fetch_array($gettopic2); $id=$_GET['id']; $message=strip_tags($getreplies3['post']); $message=nl2br($message); ?> <form action='index.php?page=reply' method='post'> <input type='hidden' name='id' value='$id'> Your message:<br> <textarea name='yourpost' rows='5' cols='40'></textarea><br> <input type='submit' name='submit' value='submit'></form> <?php } ?> </td></tr></table> <?php }} ?> Link to comment https://forums.phpfreaks.com/topic/108047-message-not-posting/ Share on other sites More sharing options...
BillyBoB Posted May 30, 2008 Share Posted May 30, 2008 Why not just leave it up to the database to fool with the id? If you set your id row to auto_increment in the extra row and make sure that your id is your primary key. Link to comment https://forums.phpfreaks.com/topic/108047-message-not-posting/#findComment-553825 Share on other sites More sharing options...
runnerjp Posted May 30, 2008 Author Share Posted May 30, 2008 hummm how do i do this lol Link to comment https://forums.phpfreaks.com/topic/108047-message-not-posting/#findComment-553827 Share on other sites More sharing options...
BillyBoB Posted May 30, 2008 Share Posted May 30, 2008 It would be much easier to describe this process over aim or msn do you have either one of those? This process is done in the structure of the database. Link to comment https://forums.phpfreaks.com/topic/108047-message-not-posting/#findComment-553829 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.