3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php //this code shows friend suggestions. //******************************************************************************** // // User Id wgaira ka code dekh lena, is script me use krne k liye. OK. $user_id set honi chahye! // //******************************************************************************** // select all users in table: tbluser $searchq = "SELECT * FROM tbluser WHERE user_id <> '$user_id' LIMIT 5"; // it will show 4/5 suggestions. change to whatever you want $searchresult = mysql_query($searchq) or die(mysql_error()); $totalusers = mysql_num_rows($searchresult); while($users = mysql_fetch_array($searchresult)){ // check if user is friend or not $uid = $users['id']; $fon="SELECT * FROM my_friends WHERE (user_id = '$uid' AND friend_id='$user_id') OR (friend_id = '$uid' AND user_id='$user_id')"; $result = mysql_query($fon) or die(mysql_error()); $row = mysql_num_rows($result); // if user is not in friend list i.e $row=0 if ($row == 0) { $uid = $users['id']; $user_photo = $users['photo']; $fullname = $users['fname'].' '.$users['lname']; // you can change the link to add friend $add_friend_link = "<a style='font-size: small;' href='add_friend.php?fid=".$uid."'>Add as friend</a>"; //you can change this html to suit your needs $html = "<img src='".$user_photo."' align='absmiddle' alt='".$fullname."' title='".$fullname."'></img>".$fullname."<br/>".$add_friend_link." <br/><br/>'; //show the html code(friend suggestions) echo $html; //if user is in friend list, following code will show next friend suggestion } else { continue; } } ?>
Output for 5.4.0 - 5.4.16
Parse error: syntax error, unexpected end of file in /in/W9ojf on line 44
Process exited with code 255.
Output for 5.3.0 - 5.3.26
Parse error: syntax error, unexpected $end in /in/W9ojf on line 44
Process exited with code 255.