[prog] PHP, MySQL error
wolf
wolf at wolfrising.net
Sun Jan 25 05:12:06 EST 2004
I'm trying to create a table which will show the info from a query on a
web page but it returns an error saying
Warning: mysql_fetch_assoc(): 14 is not a valid MySQL result resource
it does create the table and print one row, it should however print
three rows, might anyone see what's causing the
error?
here is a query I'm using:
mysql_select_db($database_connect, $connect);
$query_Conf_Sum = "select x.s_code, x.c_code, c.title, f.l_name,
f.f_name, x.status, x.confidental, x.initial_entry, x.final_entry";
$query_Conf_Sum.= " from conf_form x, section s, course c, faculty f";
$query_Conf_Sum.= " where x.s_code=$code and c.c_code = x.c_code and
s.c_code = x.c_code and s.section = x.section";
$query_Conf_Sum.= " and s.term = x.term and s.year = x.year and
s.f_code_inst = f.f_code";
$query_Conf_Sum.= " order by x.status, x.final_entry";
$Conf_Sum = mysql_query($query_Conf_Sum, $connect) or
die(mysql_error());
$row_Conf_Sum = mysql_fetch_assoc($Conf_Sum);
$totalRows_Conf_Sum = mysql_num_rows($Conf_Sum);
here's the php bit I'm using:
<table border="1" cellpadding="1" cellspacing="1">
<tr>
<td bgcolor="#6E6E9C"><strong><center>Course
Code</center></strong></td>
<td bgcolor="#6E6E9C"> <strong><center>Course
Title</center></strong></td>
<td bgcolor="#6E6E9C"><strong><center>Course
Instructor</center></strong></td>
<td bgcolor="#6E6E9C"><strong><center>Initial
Entry</center></strong></td>
<td bgcolor="#6E6E9C"><strong><center>Final
Entry</center></strong></td>
<td bgcolor="#6E6E9C"><strong><center>Status</center></strong></td>
<td
bgcolor="#6E6E9C"><strong><center>Details</center></strong></td>
</tr>
<?php
while ($row_Conf_Sum = mysql_fetch_assoc($Conf_Sum)) {
?>
<tr>
<td align="center"> <? echo $row_Conf_Sum['c_code']; ?></td>
<td align="left"><?php echo $row_Conf_Sum['title']; ?></td>
<td align="center"><?php echo $row_Conf_Sum['f_name'];
?> <?php echo $row_Conf_Sum['l_name']; ?></td>
<td align="center"><?php echo $row_Conf_Sum['initial_entry']; ?></td>
<td align="center"><?php echo $row_Conf_Sum['final_entry']; ?></td>
<td align="center"><?php echo $row_Conf_Sum['status']; ?> /
<?php echo $row_Conf_Sum['confidental']; ?></td>
<td align="center"> </td>
</tr>
<?
$Conf_Sum = mysql_query($query_Conf_Sum, $connect) or
die(mysql_error());
$totalRows_Conf_Sum = mysql_num_rows($Conf_Sum);
mysql_free_result($Conf_Sum);
?>
<?php } ?>
</table>
More information about the Programming
mailing list