I am having trouble here. I am trying to display a page of information using INNER JOIN with 3 different tables. Most of the info I need is to echo just 1 row of information according to the filenumber. But I am trying to add a section of comments to this page so that the echo statement will display all rows of comments from table 3. Now I used the WHILE statement for this and I actually have 3 rows of comments but it is displaying MANY rows of the same thing. It also is shutting down all of the other $row echos. Here is some of the code:
<?php
$user_search = $_GET['usersearch'];
$username = $_REQUEST['username'];
// Connect to the database
require_once('connectvars.php');
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$query = "SELECT * FROM casesubmission INNER JOIN casetransactions INNER JOIN contactmanager INNER JOIN casenotes ON (casesubmission.filenumber = casetransactions.filenumber = contactmanager.filenumber = casenotes.filenumber) WHERE casesubmission.filenumber = '$user_search' AND casesubmission.username = '$username' ORDER BY claimbalancedue1";
$result = mysqli_query($dbc, $query)
or die ('Error Querying Database.');
$row = mysqli_fetch_array($result);
?>
one of the prior echo statements: <?PHP echo $row['interestrate']; ?>
here is the while and echo statements afterwards which is where I want it to echo every row using the filenumber to bring it up:
<?php
while ($row = mysqli_fetch_array($result)) {
echo '<tr><td>' . $row['comments'] . '</td></tr>';
}
?>
Then it is not echoing the rest of the echos such as:
<?PHP echo $row['state']; ?> this is mixed in with some HTML after the While statement
I'm not getting an error message. What is happening is that in Table 1, I am echoing about 18 columns of info all throughout the page. But somewhere towards the end, I have the while ($row statement along with the echo for the comment.. the echo for the comment is coming from casenotes table. What I am getting is this:
Date Posted:12/02/2009 Here is some comments from the Notes Table Date Posted:12/02/2009 Here is some comments from the Notes Table Date Posted:12/02/2009 Here is some comments from the Notes Table Date Posted:12/02/2009 Here is some comments from the Notes Table Date Posted:12/02/2009 Here is some comments from the Notes Table
ETC.....
In addition, anything that is echoing AFTER the While ($row code, it is not showing up any information.
<?php
$user_search = $_GET['usersearch'];
$username = $_REQUEST['username'];
// Connect to the database
require_once('connectvars.php');
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$query = "SELECT * FROM casesubmission INNER JOIN casetransactions INNER JOIN contactmanager INNER JOIN casenotes ON (casesubmission.filenumber = casetransactions.filenumber = contactmanager.filenumber = casenotes.filenumber) WHERE casesubmission.filenumber = '$user_search' AND casesubmission.username = '$username' ORDER BY claimbalancedue1";
$result = mysqli_query($dbc, $query)
or die ('Error Querying Database.');
$row = mysqli_fetch_array($result);
?>
one of the prior echo statements: <?PHP echo $row['interestrate']; ?>
here is the while and echo statements afterwards which is where I want it to echo every row using the filenumber to bring it up:
<?php
while ($row = mysqli_fetch_array($result)) {
echo '<tr><td>' . $row['comments'] . '</td></tr>';
}
?>
Then it is not echoing the rest of the echos such as:
<?PHP echo $row['state']; ?> this is mixed in with some HTML after the While statement
I'm not getting an error message. What is happening is that in Table 1, I am echoing about 18 columns of info all throughout the page. But somewhere towards the end, I have the while ($row statement along with the echo for the comment.. the echo for the comment is coming from casenotes table. What I am getting is this:
Date Posted:12/02/2009 Here is some comments from the Notes Table Date Posted:12/02/2009 Here is some comments from the Notes Table Date Posted:12/02/2009 Here is some comments from the Notes Table Date Posted:12/02/2009 Here is some comments from the Notes Table Date Posted:12/02/2009 Here is some comments from the Notes Table
ETC.....
In addition, anything that is echoing AFTER the While ($row code, it is not showing up any information.