3v4l.org

run code in 300+ PHP versions simultaneously
<?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()); while($row_user = mysql_fetch_array($searchresult)){ // check if user is friend or not $fon="SELECT * FROM friends WHERE (user_id = '$user_id') OR (friend_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 = $row_user['id']; $user_photo = $row_user['photo']; $fullname = $row_user['fname'].' '.$row_user['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 git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $user_id in /in/9lNXG on line 12 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/9lNXG:14 Stack trace: #0 {main} thrown in /in/9lNXG on line 14
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
44.67 ms | 401 KiB | 8 Q