I have two queries. I need to run these queries so data from both tables can be displayed in one table on the web.
Here are the queries: -->
$query_data = "SELECT * FROM doc_data ORDER BY session ";
$result = mysql_query($query_data) or die ("ERROR:Unable To Run Query".mysql_error());
$fin_rate = "SELECT * FROM fin_rate";
$result_fin = mysql_query($fin_rate) or die ("ERROR:Unable To Select Finance".mysql_error());
And i need to fit both queries into a while function
while ($row=mysql_fetch_assoc())
I have tried placing these queries into the while funtions numerous ways but it keeps on messing up the table. Here are the ways i have tried.
1.
$query_data = "SELECT * FROM data_doc,fin_rate ORDER BY session";
$result_data = mysql_query($query_data) or die ("....");
while ($row=mysql_fetch_assoc($result_data)){
This places everything in the table nicely but it duplicates the data. So when the field only has 3 items it will show six. So i thought it was because i had identical fields in doc_data and fin_rate so i changed the fieldname but it made no difference so it cannot be that.
2.
$query_data = "SELECT * FROM data_doc ORDER BY session";
$result_data = mysql_query($query_data) or die ("....");
$query_finrate = "SELECT * FROM fin_rate";
$result_finrate = mysql_query($query_finrate) or die ("...");
while ($row=mysql_fetch_assoc($result)){
echo "<tr>";
echo "<td><p align=center><font face=Verdana size=-1>".$row['session']."</center></td>";
echo "<td><font face=Verdana size=-1><a href=http://pws.com/$row[url]><font face=Verdana size=-1>".$row['idea']."</td>";
echo "<td><font face=Verdana size=-1>".$row['inventor_name']."</td>";
}
while ($row=mysql_fetch_assoc($result_finrate)){
echo "<td><select name=".$ratefin['finrate_id']."> <option value= '' selected></option>\n
<option value=1>1 - Poor</option>\n
<option value=2>2 - Fair</option>\n
<option value=3>3 - Average</option>\n
<option value=4>4 - Good</option>\n
<option value=5>5 - Excellent</option>\n
</select>\n</td>";
if ($ratefin['fin_rating'] > 0){
echo "<td><p align=center><img src=reddot.gif name=already_rated height=10px width=10px></td>";
}else {
echo "<td><p align=center><img src=bluedot.gif name=need_rating height=10px width=10px></td>";
}
}
echo "</tr>\n";
The section under $row=mysql_fetch_assoc($result)) is fine but then when $row=mysql_fetch_assoc($result_finrate)) is being displayed everything is shown in columns instead of rows.
Does anyone no how this can be done?