dimanche 30 août 2015

Foreach column loop and IF EXISTS Issue

How do I send the columns for only the row selected thru another query without their values? This is what i have but i am not sure if $key is the correct value to use for this.

    echo "
    <div class='formTitle' style='position: relative; text-align: center; margin-top: 20px'>Medals</div>
    <table class='profileTable' id='medalTable' style='border-top-width: 0px'>
    ";
$mID = $_GET['mID'];
$awardObj = new Award($mysqli);
$awardObj = new Basic($mysqli, "clanawards", "name");
$result = $mysqli->query("SELECT * FROM ".$dbprefix."clanawards_members WHERE maa_member_id = '$mID'");
    while($row = $result->fetch_assoc()) {
        //RETRIEVE ALL COLUMN NAMES then run a foreach to run each one through the next query
            foreach($row = $key) {
            $result = $mysqli->query("SELECT * FROM ".$dbprefix."clanawards WHERE name = '$key'");
                while($row = $result->fetch_assoc()) {
                    $awardName = $row['name'];
                    $description = $row['description'];
                    echo "
                        <tr><td class='main' align='center'>Viewing all medals now<br><br>$awardName </td></tr> 
                    ";
            }
        }
    }
echo "</table>";

Just missing the value i need for the columns. Been racking my brain of this and need a fresh pair of eyes.

i want to send the columns for only the row selected thru another query.

Aucun commentaire:

Enregistrer un commentaire