Converting this codes

Status
Not open for further replies.

vaulient2

New Member
Mar 12, 2013
27
3
Code:
<?php

include('../core.php');
include('../includes/session.php');

$i = 0;
$output = "[";
$getem = mysql_query("SELECT * FROM messenger_friendships WHERE userid = '".$my_id."' OR friendid = '".$my_id."'") or die(mysql_error());

while ($row = mysql_fetch_assoc($getem)) {
    $i++;

    if($row['friendid'] == $my_id){
        $friendsql = mysql_query("SELECT * FROM users WHERE id = '".$row['userid']."'");
    } else {
        $friendsql = mysql_query("SELECT * FROM users WHERE id = '".$row['friendid']."'");
    }

    $friendrow = mysql_fetch_assoc($friendsql);

    $name = $friendrow['name'];
    $id = $friendrow['id'];

    $output = $output."{\"id\":".$id.",\"name\":\"".$name."\"},";
}
$output = substr_replace($output,"",-1);
$output = $output."]";
?>
/*-secure-
<?php echo $output; ?>
 */

This is the code that I'm trying to convert to replace the code below :

Code:
    case 'recipients':
   
        echo '/*-secure-' . LB;
        echo '[';
       
        $getBuddies = dbquery("SELECT receiver FROM messenger_friendships WHERE sender = '" . USER_ID . "'");
        $i = 0;
       
        while ($buddy = mysql_fetch_assoc($getBuddies))
        {
            if ($i > 0)
            {
                echo ',';
            }
           
            echo '{"id":' . $buddy['receiver'] . ',"name":"' . clean($users->id2name($buddy['receiver'])) . '"}';
       
            $i++;
        }
       
        echo ']';
        echo LB . ' */';
       
        break;

I've been trying for some time now , but I keep failing , hopefully somrbody here would help me convert the top code to replace the 2nd code
 

vaulient2

New Member
Mar 12, 2013
27
3
Well the top code is based off from a different content management system , I want to convert it and replace it with the 2nd code as it is based of the same content management system , but since it's based , it's changed.

Problem solved , close thread please.
 
Last edited by a moderator:
Status
Not open for further replies.

Users who are viewing this thread

Top