Jump to content

Change Values in a MySQL Array?


flyingeagle855

Recommended Posts

I am stuck on something here and need some help.
What I am looking to do is take and array of some values that I pulled from a MySQL database query and then I need to loop though the aray and look at CB.AVATAR for reach record and do an "if" statment to look at the value and then change the record if needed.

[code]
$query = "SELECT DISTINCT users.id, users.username, cb.avatar";
// Display Users Real Name Option
if ($display_realname != "0"){
require_once($mosConfig_absolute_path . '/administrator/components/com_comprofiler/ue_config.php');
if ($ueConfig['name_style'] == "1"){
$query .= ", users.name";
}elseif ($ueConfig['name_style'] == "2"){
$query .= ", cb.firstname, cb.lastname";
}elseif ($ueConfig['name_style'] == "3"){
$query .= ", cb.firstname, cb.middlename, cb.lastname";
}
}
if ($aboutme != "") {
$query .= ", cb.". $aboutme." as aboutme";
}
$query .= ' FROM #__users as users, #__comprofiler as cb, #__session as session WHERE users.id = session.userid and users.id = cb.id';
$database->setQuery($query);
$rows = $database->loadObjectList();
[/code]

Then latter in my code I push the array to patTemplate that automaticly goes through the array and iserts the fields I want to display.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.