Jump to content

conan318

Members
  • Posts

    195
  • Joined

  • Last visited

    Never

Everything posted by conan318

  1. yes trying to get the usersname store it the variable $getuname and call it up later here Echo '<a href="new_message.php?username=' . "$getuname" . '">send message</a>'."<br/>";
  2. i have a small search profile search and need to set $getuname variable to users username if((trim($country) !== ''&&($state) !== ''&&($city) !== '')){ $data = mysql_query("SELECT * FROM users WHERE users.state='$state' AND users.country='$Country' AND users.city='$city' ORDER BY RAND() DESC LIMIT 1 "); Echo "Country city state search"; $getuname = mysql_real_escape_string($_GET['username']); am i meant to use the get or is that only for forms?
  3. thanks heaps will be able to work this
  4. read_message.php <?php session_start(); $myusername=$_SESSION['myusername']; require "database.php"; $messageid = $_GET['messageid']; $message = mysql_query("SELECT * FROM messages WHERE message_id = '$messageid' AND to_user = '$myusername'"); $message=mysql_fetch_assoc($message); $getuname = mysql_query("SELECT from_user FROM messages Where message_id='$message_id' AND to_user ='$myusername'"); $uname_values = mysql_fetch_assoc($getuname); $uname = $uname_values['from_user']; echo "<h1>Title: ".$message['message_title']."</h1><br><br>"; echo "<h3>From: ".$message['from_user']."<br><br></h3>"; echo "<h3>Message: <br>".$message['message_contents']."<br></h3>"; echo '<form name="backfrm" method="post" action="inbox.php">'; echo '<input type="submit" value="Back to Inbox">'; echo '<a href="reply.php?username=' . "$getuname" . '">reply</a>'."<br/>"; echo '</form>'; ?> </body> </html>
  5. $getuname = mysql_query("SELECT from_user FROM messages Where message_id='$message_id' AND to_user ='$myusername'"); $uname_values = mysql_fetch_assoc($getuname); $uname = $uname_values['from_user']; just tryed that still returning resource #18
  6. do u mean $getuname[0]= mysql_query("SELECT from_user FROM messages Where message_id='$message_id' AND to_user ='$myusername'"); or echo '<a href="reply.php?username=' . "$getuname[0]" . '">reply</a>'."<br/>"; or just set a variable called $getuname[0]
  7. i am making a message system which users can message each other. sending message works fine but having trouble with the reply message cant seem to get to_user value code so far <?php session_start(); $myusername=$_SESSION['myusername']; require "database.php"; $messageid = $_GET['messageid']; $message = mysql_query("SELECT * FROM messages WHERE message_id = '$messageid' AND to_user = '$myusername'"); $message=mysql_fetch_assoc($message); // problem is here atm getuname returns Resource id instead of the username iam trying to reply to // $getuname= mysql_query("SELECT from_user FROM messages Where message_id='$message_id' AND to_user ='$myusername'"); echo "<h1>Title: ".$message['message_title']."</h1><br><br>"; echo "<h3>From: ".$message['from_user']."<br><br></h3>"; echo "<h3>Message: <br>".$message['message_contents']."<br></h3>"; echo '<form name="backfrm" method="post" action="inbox.php">'; echo '<input type="submit" value="Back to Inbox">'; // this where i need to the to user to carry over to the next page// echo '<a href="reply.php?username=' . "$getuname" . '">reply</a>'."<br/>"; echo '</form>'; ?> </body> </html>
  8. $data = mysql_query("SELECT * FROM alog, users WHERE from_user=users.username AND alog.to_user='$myusername' ORDER BY alog.id DESC LIMIT 20;") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { } if ($info['message']=='<a href=\"freindacept.php?username=$myusername\">Has sent you a friend request </a>'){ // then echo this line // Echo "<a href='viewprofile.php?username=={$info['username']}'><img src='http://datenight.netne.net/images/{$info['img']}' title='{$info['username']}' width='50' height='50'></a>".$info['from_user']." ".$info['message']."<br>"; // condition 2 will return this message// } elseif ($info['message']=="You have sent a contact request to"){ Echo " {$info['message']}{$info['to_user']}<a href='viewprofile.php?username={$info['username']}'><img src='http://datenight.netne.net/images/{$info['img']}' title='{$info['username']}' width='50' height='50'></a>"."<br>"; // and so there a few more conditions to come after this.// } elseif ($info['message']=="has sent you a message"){ Echo "<a href='viewprofile.php?username={$info['username']}'><img src='http://datenight.netne.net/images/{$info['img']}' title='{$info['username']}' width='50' height='50'></a>".$info['from_user']." ".$info['message']."<br>"; } elseif ($info['message']=="Welcome to singlesbook"){ Echo "<a href='viewprofile.php?username={$info['username']}'><img src='http://datenight.netne.net/images/{$info['img']}' title='{$info['username']}' width='50' height='50'></a>".$info['from_user']." ".$info['message']."<br>"; } elseif ($info['message']=="is Checking you out"){ Echo "<a href='viewprofile.php?username={$info['username']}'><img src='http://datenight.netne.net/images/{$info['img']}' title='{$info['username']}' width='50' height='50'></a>".$info['from_user']." ".$info['message']."<br>"; } i totally forgot about == but now the query returns nothing.. i tried just using if instead of elseif but then it would only return 1 entry instead of limit of 20..
  9. <? $data = mysql_query("SELECT * FROM alog, users WHERE from_user=users.username AND alog.to_user='$myusername' ORDER BY alog.id DESC LIMIT 10;") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { // condition 1 will return this link // if ($info['message']= "<a href=\"freindacept.php?username=$myusername\">Has sent you a friend request </a>"."<br>") { // then echo this line // Echo "<a href='viewprofile.php?username={$info['username']}'><img src='http://datenight.netne.net/images/{$info['img']}' title='{$info['username']}' width='50' height='50'></a>".$info['from_user']." ".$info['message']."<br>"; // condition 2 will return this message// } elseif ($info['message']="You have sent a contact request to") { //echo this // Echo "{$info['from_user']} {$info['message']}<a href='viewprofile.php?username={$info['username']}'><img src='http://datenight.netne.net/images/{$info['img']}' title='{$info['username']}' width='50' height='50'></a>"."<br>"; } } no errors but its not working everything is returned as if it was condition 1
  10. // condition 1 will return this link // if ($info['message']="<a href=\"freindacept.php?username=$myusername\">Has sent you a friend request </a>");{ // then echo this line // Echo "<a href='viewprofile.php?username={$info['username']}'><img src='http://datenight.netne.net/images/".$info['img'] ."' width='30' height='30''></a>".$info['from_user']." ".$info['message']; // condition 2 will return this message// }elseif ($info['message']="You have sent a contact request to"); //echo this // Echo ".$info['from_user'] .$info['message']<a href='viewprofile.php?username={$info['username']}'><img src='http://datenight.netne.net/images/".$info['img'] ."' width='30' height='30''></a>"; } } // and so there a few more conditions to come after this.// Parse error: syntax error, unexpected T_ELSE on the elseif line
  11. just a little confused where ( brackets go in this statement . im just wanting to to display the information differently depending on which message is returned from the database. thanks if ($info['message'])="<a href=\"freindacept.php?username=$myusername\">Has sent you a friend request </a>";{ Echo "<a href='viewprofile.php?username={$info['username']}'><img src='http://datenight.netne.net/images/".$info['img'] ."' width='30' height='30''></a>".$info['from_user']." ".$info['message']; }elseif ($info['message'])="You have sent a contact request to"; Echo " .$info['message']<a href='viewprofile.php?username={$info['username']}'><img src='http://datenight.netne.net/images/".$info['img'] ."' width='30' height='30''></a>".$info['from_user']."; } }
  12. the problem is now solved i worked it out after my last post and just pressed solved the button
  13. not as good as i thought... just did some more testing and seems once's the friend request is made i can contact any user and the other user cant send messages comes up with contact request.. my algorithm is wrong any idea's?
  14. that worked so i answered my own question i am getting better
  15. now the code worked but it didit do what i expecting to do.. i am new to php so bare with me // i need this query to check the friends table to see if user is friends with the profile they clicked on// $queryuser=mysql_query("SELECT * FROM freinds WHERE username='$myusername' "); //$result=mysql_query($sql); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0){ the friends table has id, username and friend so i need to check myusername against the friend. so should this be code? $queryuser=mysql_query("SELECT * FROM freinds WHERE freind='$myusername' "); //$result=mysql_query($sql); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0){
  16. so i did it azmazes me how one missing } breaks everything
  17. line 79 where the else statement is.
  18. i see in future will keep them the same..
  19. <? and <?php both open the php correct me if im wrong.
  20. need a little of help if i click on a users profile and they are on the freinds list i need to echo profile with the send message link if not echo the profile with the contact request link. this my code so far but i get an Parse error: syntax error, unexpected T_ELSE <?php session_start(); $myusername=$_SESSION['myusername']; $getuname=$_POST['to_user']; $amessage =" is Checking you out "; $message=$_POST['message']; require "database.php"; $queryuser=mysql_query("SELECT * FROM freinds WHERE username='$myusername' "); //$result=mysql_query($sql); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0){ if (!isset($_GET['username'])) { $data = mysql_query("SELECT * FROM users LEFT JOIN status ON status.username=users.username WHERE status.username = '".$_SESSION['myusername']."' ORDER BY id DESC LIMIT 1;") or die(mysql_error()); } else { $getuname = mysql_real_escape_string($_GET['username']); $data = mysql_query("SELECT * FROM users LEFT JOIN status ON status.username=users.username WHERE status.username = '".$getuname."' ORDER BY id DESC LIMIT 1;") or die(mysql_error()); } while($info = mysql_fetch_array( $data )) { ?> <!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" /> <title>Untitled Document</title> <link href="css/main.css" rel="stylesheet" type="text/css"> </head> <body> <div class="header"> <img name="Untitled1" src="Untitled-1.gif" width="1000" height="40" border="0" id="Untitled1" usemap="#m_Untitled1" alt="" /><map name="m_Untitled1" id="m_Untitled1"> <area shape="rect" coords="874,0,931,40" href="eurochat.php" alt="" title="Euro Chat"/> <area shape="rect" coords="828,0,865,40" href="englandchat.php" alt="" title="UK Chat"/> <area shape="rect" coords="754,0,822,40" href="usachat.php" alt="" title="USA Chat"/> <area shape="rect" coords="201,21,242,40" href="search.php" alt="" title="Profile Search" /> <area shape="rect" coords="697,0,747,40" href="http://datenight.netne.net/ausnz.php" alt="" title="AU n NZ Chat" /> <area shape="rect" coords="167,20,201,40" href="http://datenight.netne.net/inbox.php" alt="" title="Inbox" /> <area shape="rect" coords="119,21,164,40" href="http://datenight.netne.net/login_success.php" alt="" title="Home"/></map> </div> <div class="profile"> <? //Outputs the image and other data Echo '<a href="freinds.php?username=' . "$getuname" . '">Contact request</a>'; Echo '<a href="new_message.php?username=' . "$getuname" . '">send meesage</a>'; Echo "<img src='http://datenight.netne.net/images/".$info['img'] ."' width='150' height='150''> <br>"; Echo "<b>Name:</b> ".$info['username'] . "<br> <hr>"; Echo "<b>Sex:</b> ".$info['sex'] . " <br><hr>"; Echo "<b>Intrested in</b>" . "<br><hr>"; Echo "".$info['rel'] . " "; Echo "".$info['frwb'] . " "; Echo "".$info['ons'] . " "; Echo "".$info['fr'] . "<br><hr>"; Echo "<b>About me:</b> ".$info['aboutme'] . "<br><hr> "; Echo "<b>Looking for:</b> ".$info['looking'] . " <br><hr>"; Echo "<a href='login_success.php'>'Back'</a>"; else { Echo '<a href="freinds.php?username=' . "$getuname" . '">Contact request</a>'; Echo '<a href="new_message.php?username=' . "$getuname" . '">send meesage</a>'; Echo "<img src='http://datenight.netne.net/images/".$info['img'] ."' width='150' height='150''> <br>"; Echo "<b>Name:</b> ".$info['username'] . "<br> <hr>"; Echo "<b>Sex:</b> ".$info['sex'] . " <br><hr>"; Echo "<b>Intrested in</b>" . "<br><hr>"; Echo "".$info['rel'] . " "; Echo "".$info['frwb'] . " "; Echo "".$info['ons'] . " "; Echo "".$info['fr'] . "<br><hr>"; Echo "<b>About me:</b> ".$info['aboutme'] . "<br><hr> "; Echo "<b>Looking for:</b> ".$info['looking'] . " <br><hr>"; Echo "<a href='login_success.php'>'Back'</a>"; } } mysql_query("INSERT INTO alog (from_user, to_user, message ) VALUES ('$myusername', '$getuname','$amessage')") OR die("A log error <br>".mysql_error()); ?> </div> </body> </html>
  21. the img link is using $info[username] and the location of the img is using $info.
  22. it should because its working for the img link
  23. it kinda working but when i click the link it takes me to http://datenight.netne.net/freindacept.php?username= so its not passing the varaible $data = mysql_query("SELECT * FROM alog, users WHERE from_user=users.username AND alog.to_user='$myusername' ORDER BY alog.id DESC LIMIT 10;") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { ?> <div class="chatroom"> <? Echo "<a href='viewprofile.php?username={$info['username']}'><img src='http://datenight.netne.net/images/".$info['img'] ."' width='30' height='30''></a>".$info['from_user']." ".$info['message']; } ?> [code]
  24. here's the full code i have pretty much if someone clicks on a users profile and presses contact request link i wanting to send the link to confirm friends to alog which then shows up in the other users activity log if they press the link friends are confirmed then it takes both there users names and records them into the friends database. still getting Parse error: syntax error, unexpected T_STRING session_start(); require "database.php"; $myusername=$_SESSION['myusername']; $getuname=$_POST['to_user']; $amessage ='<a href="freindacept.php?username={$info['username']}">Has sent you a friend request </a>'; $message=$_POST['message']; if (!isset($_GET['username'])) { $data = mysql_query("SELECT * FROM users LEFT JOIN status ON status.username=users.username WHERE status.username = '".$_SESSION['myusername']."' ORDER BY id DESC LIMIT 1;") or die(mysql_error()); } else { $getuname = mysql_real_escape_string($_GET['username']); $data = mysql_query("SELECT * FROM users LEFT JOIN status ON status.username=users.username WHERE status.username = '".$getuname."' ORDER BY id DESC LIMIT 1;") or die(mysql_error()); mysql_query("INSERT INTO alog (from_user, to_user, message ) VALUES ('$myusername', '$getuname','$amessage')") OR die("A log error <br>".mysql_error()); } Echo 'freind request sent'; ?> still getting Parse error: syntax error, unexpected T_STRING
  25. $amessage ='<a href='freindacept?username=.$info['username']}.php'>Has sent you a freind request </a>'; same thing trying to post link to the database then return it later having trouble getting the syntax right. Parse error: syntax error, unexpected T_STRING in /home/a7817347/public_html/freinds.php on line 6
×
×
  • 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.