Jump to content

michaelness

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

michaelness's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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
  2. It cant be that complex surely? all i need for it to do is to get info from the database. i cant believe im stuck on this :S
  3. I'd tried that aswell. that comes up with Fatal error: Cannot use object of type stdClass as array in C:\xampp\htdocs\yourFace\editprofile.php on line 49 if it helps on my other page View Profile i am accessing the tables like this $row->music but i havent been able to get that to work either. is my variable at the top of the page right? the $email = $_POST['music']; bit?
  4. ahh after i posted that i did what you just explained anyway and it didnt work. i got this line Parse error: parse error, expecting `','' or `';'' in C:\xampp\htdocs\yourFace\editprofile.php on line 49 using this <TEXTAREA name="music", ROWS="5", COLS="45", wrap=virtual>$row['music']</TEXTAREA>
  5. im sorry to sound ignorant but im not sure what you mean mate
  6. im sorry, that was a typo and me being tired. this is the actual code <!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" />'; include 'connection.php'; ?> <head> <title>yourFace</title> </head> <body> <?php $var = $_COOKIE['username']; $music = $_GET['music']; include 'connection.php'; $query = "SELECT * FROM `userinfo` WHERE username='$var'"; $result = mysql_query($query); $row = mysql_fetch_object($result); if(isset($_COOKIE['username'])){ echo ' <form enctype="multipart/form-data" action="uploader.php" method="POST"> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> <form action="updateprofile.php" method="post"> <label>Age: </label><br> <input type="int" name="age" id="age"><br> <label>Interests: </label><br> <TEXTAREA name="interests", ROWS="5", COLS="45", wrap=virtual></TEXTAREA><br> <label>Hometown: </label><br> <TEXTAREA name="hometown", ROWS="1", COLS="30", wrap=virtual></TEXTAREA><br> <label>Music: </label><br> <TEXTAREA name="music", ROWS="5", COLS="45", wrap=virtual>' . $music . '</TEXTAREA>; <br> <label>:Favourite TV: </label><br> <TEXTAREA name="tv", ROWS="5", COLS="45", wrap=virtual></TEXTAREA><br> <label>:Favourite Films: </label><br> <TEXTAREA name="films", ROWS="5", COLS="45", wrap=virtual></TEXTAREA><br> <label>:Relationship Status: </label><br> <TEXTAREA name="relation", ROWS="5", COLS="45", wrap=virtual></TEXTAREA><br> <input type="submit" name="submit" id="submit" value="Submit"> </form> '; } //when not logged in else { echo 'You Are Not Logged In'; } ?> </body> </html>
  7. <!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" />'; include 'connection.php'; ?> <head> <title>yourFace</title> </head> <body> <?php $var = $_COOKIE['username']; include 'connection.php'; $query = "SELECT * FROM `userinfo` WHERE username='$var'"; $result = mysql_query($query); $row = mysql_fetch_object($result); if(isset($_COOKIE['username'])){ echo ' <form enctype="multipart/form-data" action="uploader.php" method="POST"> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> <form action="updateprofile.php" method="post"> <label>Age: </label><br> <input type="int" name="age" id="age"><br> <label>Interests: </label><br> <TEXTAREA name="interests", ROWS="5", COLS="45", wrap=virtual></TEXTAREA><br> <label>Hometown: </label><br> <TEXTAREA name="hometown", ROWS="1", COLS="30", wrap=virtual></TEXTAREA><br> <label>Music: </label><br> <TEXTAREA name="music", ROWS="1", COLS="30", wrap=virtual>$music</TEXTAREA><br> echo '<TEXTAREA name="music", ROWS="5", COLS="45", wrap=virtual>' . $music . '</TEXTAREA>'; <br> <label>:Favourite TV: </label><br> <TEXTAREA name="tv", ROWS="5", COLS="45", wrap=virtual></TEXTAREA><br> <label>:Favourite Films: </label><br> <TEXTAREA name="films", ROWS="5", COLS="45", wrap=virtual></TEXTAREA><br> <label>:Relationship Status: </label><br> <TEXTAREA name="relation", ROWS="5", COLS="45", wrap=virtual></TEXTAREA><br> <input type="submit" name="submit" id="submit" value="Submit"> </form> '; } //when not logged in else { echo 'You Are Not Logged In'; } ?> </body> </html> I've been messing around with $music = $_POST['music']; aswell. the problem is im exceedingly tired. this is literally the last thing I have to do on this site, and im slowly going insane
  8. hmmm well im getting the error Parse error: parse error, expecting `','' or `';'' in C:\xampp\htdocs\yourFace\editprofile.php on line 50 I am so lost ???
  9. I cant seem to get it to work echo '<TEXTAREA name="music", ROWS="5", COLS="45", wrap=virtual>' . $music . '</TEXTAREA>';
  10. Right I have a page set up where a user can edit fields in the database specific to that user (interests, music etc). What i want to be able to do is to have the data from the database that the user has already put in showing in the text area when the user goes to edit them. Because at the moment everytime the user goes to edit a field and send it. it resets the other field to blank if there is nothing in their. <?php echo '<link rel="stylesheet" type="text/css" href="original.css" />'; include 'connection.php'; ?> <head> <title>yourFace</title> </head> <body> <?php $var = $_COOKIE['username']; include 'connection.php'; $query = "SELECT * FROM `userinfo` WHERE username='$var'"; $result = mysql_query($query); $row = mysql_fetch_object($result); if(isset($_COOKIE['username'])){ echo ' <form enctype="multipart/form-data" action="uploader.php" method="POST"> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> <form action="updateprofile.php" method="post"> <label>Age: </label><br> <input type="int" name="age" id="age"><br> <label>Interests: </label><br> <TEXTAREA name="interests", ROWS="5", COLS="45", wrap=virtual></TEXTAREA><br> <label>Hometown: </label><br> <TEXTAREA name="hometown", ROWS="1", COLS="45", wrap=virtual></TEXTAREA><br> <label>Hometown: </label><br> <TEXTAREA name="music", ROWS="5", COLS="45", wrap=virtual> </TEXTAREA><br> <label>:Favourite TV: </label><br> <TEXTAREA name="tv", ROWS="5", COLS="45", wrap=virtual><"$tv";</TEXTAREA><br> <label>:Favourite Films: </label><br> <TEXTAREA name="films", ROWS="5", COLS="45", wrap=virtual></TEXTAREA><br> <label>:Relationship Status: </label><br> <TEXTAREA name="relation", ROWS="5", COLS="45", wrap=virtual></TEXTAREA><br> <input type="submit" name="submit" id="submit" value="Submit"> </form> '; } //when not logged in else { echo 'You Are Not Logged In'; } ?> </body> </html> Please help me with this problem, I know something should go into the text area bits but i cant figure out what.
  11. ok, well when I click on upload picture, it copies the picture into the directory "pics" which is good. I want to get the picture name from that directory into the table "userinfo" in the row "photo" This is my upload page. <?php include 'connection.php'; echo '<link rel="stylesheet" type="text/css" href="original.css" />'; //This is the directory where images will be saved $target = "pics/"; $target = $target . basename( $_FILES['photo']['name']); $photo=($_POST['photo']['name']); ; //Writes the information to the database $query = "UPDATE userinfo SET photo = '$photo'"; $result = mysql_query($query); //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?>
  12. Basically I have a page called editprofile with this upload form <form enctype="multipart/form-data" action="upload.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> Now need the page upload.php to save that image to my database which is called "userinfo" in the row "photo" this is my upload.php form <?php include 'connection.php'; echo '<link rel="stylesheet" type="text/css" href="original.css" />'; $target_path = "pics/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?> and then after that I would like a user who is logged into be able to view that image as their profile picture
×
×
  • 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.