Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
what is the advantage of using sql builder?

what is the advantage of using sql builder?
And how would i redo this to use sql builder?
And how would i redo this to use sql builder?
function Friends_GetFriendStatusLists(){
global $Context;
$selfID = $Context->Session->UserID;
$Friends_FriendRequests = array(
'Friends_MyRequests_UserID'=>array(),
'Friends_MyRequests_FriendStatus'=>array(),
'Friends_RequestsToMe_UserID'=>array(),
'Friends_RequestsToMe_FriendStatus'=>array()
);
$Friends_MyRequestsQuery = mysql_query("SELECT Friend, FriendStatus FROM LUM_Friends WHERE UserID = '$selfID'");
if (!$Friends_MyRequestsQuery) {
die('Invalid query: ' . mysql_error());
}
$Friends_RequestsToMeQuery = mysql_query("SELECT UserID, FriendStatus FROM LUM_Friends WHERE Friend = '$selfID'");
if (!$Friends_RequestsToMeQuery) {
die('Invalid query: ' . mysql_error());
}
$listcount = '';
while ($row = mysql_fetch_array($Friends_MyRequestsQuery)) {
$Friends_FriendRequests['Friends_MyRequests_UserID'][$listcount]= $row['Friend'];
$Friends_FriendRequests['Friends_MyRequests_FriendStatus'][$listcount]= $row['FriendStatus'];
$listcount++;
}
$listcount = '';
while ($row = mysql_fetch_array($Friends_RequestsToMeQuery)) {
$Friends_FriendRequests['Friends_RequestsToMe_UserID'][$listcount]= $row['UserID'];
$Friends_FriendRequests['Friends_RequestsToMe_FriendStatus'][$listcount]= $row['FriendStatus'];
$listcount++;
}
return($Friends_FriendRequests);
}
0
This discussion has been closed.
Comments
one thing, though. I would recommend using the database class to access mysql functions rather than simply calling them. It provides a nice wrapper allowing for more extensibility and better error management.
$Context->Database->Execute('query here', 'current class name', 'current function name', 'error message');
I will be sure to make this change either way way, Thanks for the tip!