Jump to content

Outputing array from MySQL into table


styphon

Recommended Posts

I am trying to load all rows from a table in a database into a table on a webpage. I cannot understand why the following code does not work:

<?php ...echo "You are currently in a fleet. The details of the fleet are below.<br>";$fleetName = $_SESSION['charFleetName'];$sqlFleetDetails = "SELECT * FROM `$fleetName`";$queryFleetDetails = mysql_query($sqlFleetDetails);echo "<table>";	echo "<tr>";		echo "<th>Pilot</th>";		echo "<th>Ship</th>";		echo "<th>Type</th>";	echo "</tr>";while($rowFleetDetails = mysql_fetch_array($queryFleetDetails)) {	$charId = $rowFleetDetails['charId'];	$charName = $rowFleetDetails['charName'];	$shipHull = $rowFleetDetails['shipHull'];	$shipType = $rowFleetDetails['shipType'];	echo "<tr>";		echo "<td><a href=\"#\" onClick=\"CCPEVE.showInfo{1377, " . $charId . "}>" . $charName . "</a></td>";		echo "<td>" . $shipHull . "</td>";		if($shipType == 1)			echo "<td>Logistics</td>";		if($shipType == 2)			echo "<td>DPS Boat</td>";		if($shipType == 3)			echo "<td>Sniper 120Km+</td>";		if($shipType == 4)			echo "<td>Off-grid Booster</td>";	echo "</tr>";}echo "</table><br>";

I originally had the $rowFleetDetails['charId'] and others in the echo instead of loading them into variables then echoing the variables but changed it to see if that was working, neither is. If I add an extra line outside of the while loop to echo the output of the array then the information is displayed fine, so I know that the information is being transferred from the table into the array correctly, but why is it not outputting properly in the While loop?

Link to comment
Share on other sites

What EXACTLY doesn't work?I'm worried about this line:

echo "<td><a href=\"#\" onClick=\"CCPEVE.showInfo{1377, " . $charId . "}>" . $charName . "</a></td>";

I do not see a closing quotation mark to match this one: onClick=\" , so that probably kills your click handler and possibly a lot of stuff that follows.CCPEVE.showInfo{1377, " . $charId . "} -- What are those { } doing there? If showInfo is a method, shouldn't those be parens ( ) ?

Link to comment
Share on other sites

What EXACTLY doesn't work?I'm worried about this line:
echo "<td><a href=\"#\" onClick=\"CCPEVE.showInfo{1377, " . $charId . "}>" . $charName . "</a></td>";

I do not see a closing quotation mark to match this one: onClick=\" , so that probably kills your click handler and possibly a lot of stuff that follows.CCPEVE.showInfo{1377, " . $charId . "} -- What are those { } doing there? If showInfo is a method, shouldn't those be parens ( ) ?

The onClick is a special event that works in an in-game browser in eve. It was just the missing quotation mark, thanks :).
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...