Originally posted by longbow
the fields go:
ID, comments, name
and i want to select both the name and comments and post them in one Cell of a table that i have ti set to print
Then simply modify your original code to something like this:
mysql_select_db("test",$conn);
// select comments and name from all rows
$sql = "SELECT comments,name FROM journal ORDER BY id DESC";
$result = mysql_query($sql, $conn) or die(mysql_error());
while ($newArray = mysql_fetch_array($result)) {
print "<tr><td align=\"center\" bgcolor=\"#7F7F7F\"><BR>";
// print name and comments
echo $newArray['name'];
echo "<br>";
echo $newArray['comments'];
print "</tr></td>";
}
Note that the way you were originally reading the array into new variables is redundant. You can print the values straight from the array like I did above which saves you having to do stuff like this:
$blah = $newArray['comments']; // not necessary