Need help selecting certain values
Posted: Sat Mar 04, 2006 1:02 am
Hello.
I have a code that connects to 2 tables.
Here is the code.
I am having trouble with $sql4. I think it is working. However it does not show all of the rows that have the value of the number. How can I make it view all?
Thanks!
I have a code that connects to 2 tables.
Here is the code.
Code: Select all
<?
error_reporting('e_all');
$username2= "muot_report";
$password2= "report";
$database2= "muot_report";
$connection2 = mysql_connect('localhost',$username2,$password2);
mysql_select_db($database2);
$sql2 = "SELECT * FROM `report` WHERE Live = 1";
$result = mysql_query($sql2) or die(mysql_error());
$row = mysql_fetch_assoc($result);
echo $row['Code'];
?><br><br>
<form action=/site/muotReport/addComment.php method=get>
<table border=1>
<tr>
<td>
Your Name:
</td>
<td><input type=text size=23 name=yourname></td>
</tr>
<tr>
<td>Your Comment:</td>
<td><textarea rows=10 name=comments></textarea></td>
</tr>
<tr><td colspan=2 align=center><input type=hidden name=who value="<? echo $row['Number']; ?>"> <input type=submit></td></tr>
</table>
</form>
<?
$sql4 = "SELECT * FROM `comments` WHERE who =".$row['Number'];
$result4 = mysql_query($sql4) or die(mysql_error());
while($row4 = mysql_fetch_array($query4)) {
echo $row4['comment'];
};
mysql_close($connection2);
?>Thanks!