michaelness Posted June 24, 2009 Share Posted June 24, 2009 One this page "friendprofile" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php echo '<link rel="stylesheet" type="text/css" href="original.css" />'; ?> <title>yourFace</title> </head> <?php $U = $_GET['friendusername']; if(isset($_COOKIE['username'])) echo"<j>$U </j>"; ?> <?php $var = $_COOKIE['username']; include 'connection.php'; $query = "SELECT * FROM `userinfo` WHERE username='$U'"; $result = mysql_query($query); $row = mysql_fetch_object($result); if(isset($_COOKIE['username'])){ echo" <br> <img src= '$row->photo' align ='left' width = '200' /> <br><br><b> Name:</b> $row->first $row->last <br><br> <b>E-mail:</b> $row->email<br><br> <b>Age:</b> $row->age<br><br> <br> <br> <br> <br> <br> <br> <br> <br> <table> <b>Hometown:</b> $row->hometown<br><br> <b>Interests:</b> $row->interests<br><br> <tr> <b>Favourite Music:</b> $row->music<br><br> </tr> <b>Favourite TV:</b> $row->tv<br><br> <b>Favourite Films:</b> $row->films<br><br> <b>Relationship Status:</b> $row->relation<br><br> "; } //when not logged in else { echo "You Are Not Logged In"; } ?> <br> <br> <br> <br> <br> <br> <form action="" method="post"> <TEXTAREA name="comment", ROWS="3", COLS="45", wrap=virtual></TEXTAREA> <br/> <input type="submit" value="Comment"/> </form> <?php $username = $_COOKIE['username']; $U = $_GET['friendusername']; include 'connection.php'; {mysql_query("INSERT INTO comments (comment, username, friendusername) VALUES ('$_POST[comment]','$username',')"); } ?> </body> </html> Basically this page is accessed by a user who has logged in and has this other user as their friend (which is set manually in the database) the user clicks on their name and is taken to their profile in which i wanted to be able to comment on their wall. now i wanted this to work by having the comment the cookie'd user has entered be inserted into the friends username comment field. the table userinfo looks like this username first last email interests photo age hometown music tv films relation comment then depending on the username of the profile that is being viewed the comment would then be inserted into their row. i can only get a comment to appear in the cookie'd username row. this is my savecomment page <?php $username = $_COOKIE['username']; $U = $_GET['friendusername']; include 'connection.php'; {mysql_query("INSERT INTO comments (comment, username, friendusername) VALUES ('$_POST[comment]','$username',')"); } ?> if anyone would like to discuss this on msn it would greatly help me Quote Link to comment https://forums.phpfreaks.com/topic/163565-ok-one-last-problem-and-then-ill-leave-you-guys-alone/ Share on other sites More sharing options...
Bman900 Posted June 24, 2009 Share Posted June 24, 2009 Am no exper here but this might be wrong: ('$_POST[comment]','$username',')"); Shouldn't there be another value there as ur inserting into 3 collumns. Quote Link to comment https://forums.phpfreaks.com/topic/163565-ok-one-last-problem-and-then-ill-leave-you-guys-alone/#findComment-862977 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.