
February 2nd, 2000, 05:41 PM
|
|
Junior Member
|
|
Join Date: Feb 2000
Location: NY, NY,USA
Posts: 18
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I'm having trouble with these lines:
$dept_name = mysql_query ("SELECT department_name FROM dept_info WHERE dept_id = '$row["dept_id"]'");
print $dept_name;
It seems to be printing the array index, and not a result from the mysql_query. The Query works if I type it in the command line with an explicit value substituted for the $row["dept_id"]
This line :
print $row["dept_id"];
is printing the correct value to HTML.
Here's the code:
$result = mysql_query ("SELECT * FROM jobs");
print ("<table>");
if ($row = mysql_fetch_array($result)) {
do {
print ("<tr><td bgcolor=#cccccc>");
print $row["position_name"];
print ("</td><td>");
print ("<b>");
print $row["dept_id"];
print ("</b>");
$dept_name = mysql_query ("SELECT department_name FROM dept_info WHERE dept_id = '$row["dept_id"]'");
print $dept_name;
print ("</td></tr>"); }
while($row = mysql_fetch_array($result)); }
else {print "Sorry, no records were found!";}
print ("</table>");
[This message has been edited by brett_webb (edited February 02, 2000).]
|