Jump to content

Displaying subscripts if a condition is met and matching ordered listed items


twilitegxa

Recommended Posts

I have the following code:

 

$get_sub_attributes = "select * from scout_sub_attributes where identity = '$identity'";
$get_sub_attributes_res = mysql_query($get_sub_attributes, $conn) or die(mysql_error());

while ($sub_attributes_info = mysql_fetch_array($get_sub_attributes_res)) {
$sub_attributes_id = $sub_attributes_info['id'];
$sub_attributes_identity = $sub_attributes_info['identity'];
$sub_attributes_attribute_id = $sub_attributes_info['sub_attribute_id'];
$sub_attributes_level_id = $sub_attributes_info['level_id'];
$sub_attributes_notes = $sub_attributes_info['notes'];

$get_sub_attribute_names = "select * from sub_attributes where id = '$sub_attributes_attribute_id'";
$get_sub_attribute_names_res = mysql_query($get_sub_attribute_names, $conn) or die(mysql_error());

while ($sub_attribute_names_info = mysql_fetch_array($get_sub_attribute_names_res)) {
$sub_attribute_names_id = $sub_attribute_names_info['id'];
$sub_attribute_names_attribute = $sub_attribute_names_info['sub_attribute'];
$sub_attribute_names_points = $sub_attribute_names_info['points'];
$sub_attributes_points = ($sub_attribute_names_points * $sub_attributes_level_id);

$display_block .= "
<tr>
<td class=indent>$sub_attribute_names_attribute</td>
<td class=align_levels>$sub_attributes_level_id</td>
<td class=align_levels>$sub_attributes_points</td>
</tr>";

}
}

 

What I want to do, is if there is a value in the notes field of the scout_sub_attributes table (in other words, if it is not null), then I want to display a subscript (1, 2, 3...etc) after the sub_attribute_names_attribute. I also have this code:

 

//gather attributes and sub-attributes notes

$get_sub_notes = "select notes from scout_sub_attributes where identity = '$identity' and notes IS NOT NULL";
$get_sub_notes_res = mysql_query($get_sub_notes, $conn) or die(mysql_error());

while ($sub_notes_info = mysql_fetch_array($get_sub_notes_res)) {
$sub_notes = $sub_notes_info['notes'];

$display_block.= "
<li>$sub_notes</li>";

}

 

And I want the subscript from above to match the listed item from this code above. Is this possible? And if so, how could I do it? Does it make sense what I want to do? Here is an example:

 

Combined Attack1

 

Then later on down the page:

 

1. some text from the sub_attribute_notes for Combined Attack

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

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