Reputation: 974
I have database table with users. There is one column called fkhouseid
which can be (1, 2, 3, 4, 5) it connects user to the house which leads to another table with house names.
I am trying to print each user in separate column for each house. Here is first query to get users:
$numbers = '12345';
$unityResult = getUnityEmail();
Then get number of houses:
$houseResult = getHouses();
$count = mysqli_num_rows($houseResult);
There are 5 houses in total. Then I am trying to print names for each house:
for ($x=0;$x<$count;$x++){
echo "<div id='memberList$x' style='display:inline-block;vertical-align:top'>";
echo "<fieldset class=fieldname style='display:inline'>";
if( $numbers[$x] == 1){ echo "<legend class=name_legend>u</legend>"; }
else if( $numbers[$x] == 2){ echo "<legend class=name_legend>n</legend>"; }
else if( $numbers[$x] == 3){ echo "<legend class=name_legend>i</legend>"; }
else if( $numbers[$x] == 4){ echo "<legend class=name_legend>t</legend>"; }
else{ echo "<legend class=name_legend>y</legend>"; }
echo "<ul class='list'>";
while ($row_unity = mysqli_fetch_array($unityResult)) {
if ($row_unity['fkhouseid'] == $numbers[$x]) {
format_member_list_filters( $row_unity);
}
}
echo "</ul>";
echo "</fieldset>";
echo "<br>";
echo "</div>";
mysqli_data_seek($houseResult, 0);
}
I am to get houses(each letter for each house) but I am not able to get names according their houses:
How I can make it display names for other columns too?
Upvotes: 1
Views: 51
Reputation: 974
The problem was easy to solve.
mysqli_data_seek($houseResult, 0);
Changed to
mysqli_data_seek($unityResult, 0);
Upvotes: 1