Jump to content

Ok. One last problem and then I'll leave you guys alone..


michaelness

Recommended Posts

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

 

 

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.