PHP Mysqli_fetch_array is looping Over and Over and Over! Help!!!?

Phil M

New member
Hello,
For some reason, I always have problems with these WHILE statements. I am receiving a result that keep looping over and over again when it should just show what I want it to show. Here is my code:

$query = "SELECT * FROM contactmanager INNER JOIN casetransactions ON (contactmanager.username = casetransactions.author) INNER JOIN casesubmission ON (contactmanager.username = casesubmission.username) INNER JOIN casenotes ON (contactmanager.username = casenotes.username) WHERE contactmanager.username = '$username'";
$result = mysqli_query($dbc, $query);

while ($row = mysqli_fetch_array($result)) {
echo '<td>' . $row['contactdate'] . '</td>';
echo '<td>' . $row['fullname'] . '</td>';
echo '<td>' . $row['amountowed'] . '</td>';
echo '<td>' . $row['accountstatus'] . '</td>';
}

------------------------------------------------
I would like the statement to show all rows where the username equals the username.
I have 4 different tables I am pulling information from, but they all have the same username.
I had this problem before and cannot figure out what the issue is.
I think it is a little more complex than that. What I have is 1 Table with 2 Rows of info, but I am trying to take information from Table 2, Table 3, & Table 4 which has multiple rows of for the same username. But what i need is only 1 row of information from table 2,3, & 4 PER filenumber. There are only 2 filenumbers in table 1. I am not sure if what I am doing is even possible.
 
Back
Top