it does not call everything correctly as shown in the image...
here is the code.... I have spent forever reading php but cannot find the problem... any help I would be very grateful
Spoiler: [ Show ]
Spoiler: [ Hide ]
$mode = isset($_POST['mode']) ? $_POST['mode'] : $_GET['mode'];
$user = isset($_POST['user']) ? intval($_POST['user']) : intval($_GET['user']);
$char = isset($_POST['char']) ? intval($_POST['char']) : '';
$action = isset($_POST['action']) ? $_POST['action'] : '';
$sql = 'SELECT *
FROM '. USER_CHARACTERISTICS_TABLE .'
GROUP BY characteristics_name';
$r = $db->sql_query($sql);
$uc_rows = $db->sql_fetchrowset($r);
$sql = 'SELECT *
FROM '. USER_CHARACTERISTICS_DATA_TABLE .'
ORDER BY characteristics_id DESC';
$r = $db->sql_query($sql);
$uc_data_rows = $db->sql_fetchrowset($r);
if ($mode == 'who')
{
$template->assign_block_vars('who', array());
$sql = 'SELECT username, user_id
FROM '. USERS_TABLE;
$r = $db->sql_query($sql);
$users = $db->sql_fetchrowset($r);
for ($x = 0; $x < count($uc_data_rows); $x++)
{
if ($uc_data_rows[$x]['to_user_id'] == $user)
{
for ($y = 0; $y < count($users); $y++)
{
if ($uc_data_rows[$x]['from_user_id'] == $users[$y]['user_id'])
{
$user_id = $users[$y]['user_id'];
$username = $users[$y]['username'];
break;
}
};
$template->assign_block_vars('who.rows', array(
'ROW_CLASS' => (($x % 2) ? $theme['td_class2'] : $theme['td_class1']),
'CHARACTERISTIC' => $uc_rows[$x]['characteristics_name'],
'IMAGE' => '<img src="images/user_characteristics/'. $uc_rows[$x]['characteristics_img'] .'" >',
'WHO' => '<a href="profile.'. $phpEx .'?mode=viewprofile&u='. $user_id .'" target="_parent">'. $username .'</a>')
);
}
}
}
$template->set_filenames(array('body' => 'user_characteristics_body.tpl'));
$template->assign_vars(array(
'L_IMAGE_TITLE' => $lang['uc_main_image'],
'L_NAME_TITLE' => $lang['uc_main_name'],
'L_VOTES_TITLE' => $lang['uc_main_votes'],
'L_SUBMIT' => $lang['uc_main_add'],
'HIDDEN' => $hidden,
'ACTION' => append_sid('user_characteristics.'. $phpEx))
);
include_once($phpbb_root_path .'includes/page_header.'. $phpEx);
$template->pparse('body');
include_once($phpbb_root_path .'includes/page_tail.'. $phpEx);
$user = isset($_POST['user']) ? intval($_POST['user']) : intval($_GET['user']);
$char = isset($_POST['char']) ? intval($_POST['char']) : '';
$action = isset($_POST['action']) ? $_POST['action'] : '';
$sql = 'SELECT *
FROM '. USER_CHARACTERISTICS_TABLE .'
GROUP BY characteristics_name';
$r = $db->sql_query($sql);
$uc_rows = $db->sql_fetchrowset($r);
$sql = 'SELECT *
FROM '. USER_CHARACTERISTICS_DATA_TABLE .'
ORDER BY characteristics_id DESC';
$r = $db->sql_query($sql);
$uc_data_rows = $db->sql_fetchrowset($r);
if ($mode == 'who')
{
$template->assign_block_vars('who', array());
$sql = 'SELECT username, user_id
FROM '. USERS_TABLE;
$r = $db->sql_query($sql);
$users = $db->sql_fetchrowset($r);
for ($x = 0; $x < count($uc_data_rows); $x++)
{
if ($uc_data_rows[$x]['to_user_id'] == $user)
{
for ($y = 0; $y < count($users); $y++)
{
if ($uc_data_rows[$x]['from_user_id'] == $users[$y]['user_id'])
{
$user_id = $users[$y]['user_id'];
$username = $users[$y]['username'];
break;
}
};
$template->assign_block_vars('who.rows', array(
'ROW_CLASS' => (($x % 2) ? $theme['td_class2'] : $theme['td_class1']),
'CHARACTERISTIC' => $uc_rows[$x]['characteristics_name'],
'IMAGE' => '<img src="images/user_characteristics/'. $uc_rows[$x]['characteristics_img'] .'" >',
'WHO' => '<a href="profile.'. $phpEx .'?mode=viewprofile&u='. $user_id .'" target="_parent">'. $username .'</a>')
);
}
}
}
$template->set_filenames(array('body' => 'user_characteristics_body.tpl'));
$template->assign_vars(array(
'L_IMAGE_TITLE' => $lang['uc_main_image'],
'L_NAME_TITLE' => $lang['uc_main_name'],
'L_VOTES_TITLE' => $lang['uc_main_votes'],
'L_SUBMIT' => $lang['uc_main_add'],
'HIDDEN' => $hidden,
'ACTION' => append_sid('user_characteristics.'. $phpEx))
);
include_once($phpbb_root_path .'includes/page_header.'. $phpEx);
$template->pparse('body');
include_once($phpbb_root_path .'includes/page_tail.'. $phpEx);