0
<?
$id = ($_GET["id"]);
$query = mysql_query("SELECT * FROM champions WHERE id=$id") or die("Error: " .       mysql_error());

while($row = mysql_fetch_array($query)){
$name = $row[1];
$icon = $row[2];
$picon = $row[4];
$passive = $row[5];
$qicon = $row[6];
$qskill = $row[7];
$wicon = $row[8];
$wskill = $row[9];
$eicon = $row[10];
$eskill = $row[11];
$ricon = $row[12];
$rskill = $row[13];
$ad = $row[14];
$as = $row[15];
$arm = $row[16];
$mr = $row[17];
$mov = $row[18];
$hp = $row[19];
$mana = $row[20]; 


$secquery = mysql_query("SELECT * FROM icons WHERE picid=1") or die("Error: " .    mysql_error());
while($row = mysql_fetch_array($secquery)){

$hpicon = $row[1];
$manaicon = $row[2];

echo '<div class="container-fluid">';
echo '<div class="row-fluid">';
echo '<div class="span6">';
echo '<table id="noborder">';
echo '<tr>';
echo '<td><img src="data:image/png;base64,' . base64_encode($icon) . '" /></td>';
echo '<td>' . $name . '</td>';  
echo '</tr>';
echo '</table>';
echo '</div>';
}

echo '<div class="span6">';
echo '<table id="noborder" >';
echo '<tr><td id="celltop" width="64px"><img src="data:image/png;base64,' .    base64_encode($picon) . '" /> </td><td>' . $passive . '</td></tr>';
echo '<tr><td id="celltop" width="64px"><img src="data:image/png;base64,' . base64_encode($qicon) . '" /> </td><td>' . $qskill . '</td></tr>';
echo '<tr><td id="celltop" width="64px"><img src="data:image/png;base64,' . base64_encode($wicon) . '" /> </td><td>' . $wskill . '</td></tr>';
echo '<tr><td id="celltop" width="64px"><img src="data:image/png;base64,' . base64_encode($eicon) . '" /> </td><td>' . $eskill . '</td></tr>';
echo '<tr><td id="celltop" width="64px"><img src="data:image/png;base64,' . base64_encode($ricon) . '" /> </td><td>' . $rskill . '</td></tr>';
echo '</table>';
echo '</div>';    

}

?>

I have a 117 different pages. What I'm trying to do is call icons from a separate table which will be the same for all 117 pages, that's why I've stored them in a different table. But I need to call the icons among the data from the other table.

1 Answer 1

1

even if you get this working this many hits on your database is a bad idea and will be very slow I would re engineer this to only hit the database once or at most twice to get all the values you need

Possible ideas

OPT A write view that contains everything you need joint originally from the icons table then to the champions table either duplicating the champions for each icon then just create a couple of loops

OPT B get all the icons then and pop them in a class structure to then retrieve as you need them from memory rather than per record.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.