[thelist] php array help...

Sowers, Matthew (CSC) Sowers at VOLPE.DOT.GOV
Tue Mar 20 12:28:09 CST 2001

What'd I'd do is set a flag at the beginning of the PHP, and then do a logical choice on then when it comes time.


// Here's the flag

if ($myrow = mysql_fetch_array($sql_result)) {

// Switch statement that will set class and reset the flag
			case 0:
			case 1:

		if ($myrow
		print ("<tr class=\"$color\">\n".
		"<td class=\"$color\">".$myrow['size']."</td>\n".
		"<td class=\"$color\">".$myrow['luff_length']."</td>\n".
		"<td class=\"$color\">".$myrow['boom_length']."</td>\n".
		"<td class=\"$color\">".$myrow['mast']."</td>\n".
		"<td class=\"$color\">".$myrow['mcs']."</td>".
		"<td class=\"$color\">".$myrow['imcs']."</td></tr>");
		while ($myrow = mysql_fetch_array($sql_result));
		echo "</table>";
		} else {
	echo "Sorry, no records were found.";

>Here's my code, which retrieves a group of records from a database (with a
>mere 7 fields) and writes the contents into a table.
>I' dlove any help...thanks,
>John Corry

Try this and see if it works, it's what I typically use for that sort of thing.


More information about the thelist mailing list