Hello dear Stack Overflow !
I am making a table with two entries with PHP & SQL, in this case I get my WHERE
value from a $_GET['id']
and my SQL query is a Stored Procedure.
Here the result wanted (That's a manual preview (HTML)): ex
The PHP code of the table:
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Lv.1</th>
<th scope="col">Lv.2</th>
<th scope="col">Lv.3</th>
<th scope="col">Lv.4</th>
<th scope="col">Lv.5</th>
<th scope="col">Lv.6</th>
<th scope="col">Lv.7</th>
<th scope="col">Lv.8</th>
</tr>
</thead>
<tbody>
<?php foreach($getValues as $effect): ?>
<tr>
<th scope="row"><?php echo $effect['effect_fastdesc']; ?></th>
<?php foreach($getValues as $lvl): ?>
<td>
<?php if($lvl['effect_id'] === $effect['effect_id']):
echo $lvl['effect_value'];
else:
echo '-';
endif; ?>
</td>
<?php endforeach;?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
Here the output of my SQL: ex
and the SQL code:
CREATE DEFINER=`root`@`localhost` PROCEDURE `gettest`(`weap_id` INT(11))
BEGIN
SELECT
game_weapons.weap_name,
game_weap_levelup.weap_level,
game_weapons.weap_img,
game_weapons.weap_desc,
game_weapons.weap_tips,
game_effectlist.effect_fastdesc,
game_weap_levelup.effect_id,
game_weap_levelup.effect_value,
game_weap_levelup.weap_up,
game_weap_levelup.weap_up_id,
game_weap_levelup.pass_up_id
FROM
game_weapons
INNER JOIN game_weap_levelup ON game_weapons.weap_id = game_weap_levelup.weap_id
INNER JOIN game_effectlist ON game_weap_levelup.effect_id = game_effectlist.effect_id
WHERE
game_weapons.weap_id = weap_id;
END
As you can see effect_fastdesc
give me the plain text but I would like to get it only 1 time on the table.
What happend currently:
ex
I have already trying with the PHP array_unique()
function, and don't have get it working.
Thanks you for any help you can give me, to understand how to do it.