Skip to content

Commit

Permalink
Use ids in the links.
Browse files Browse the repository at this point in the history
(Anyway WHY use 3 query and not a single, efficient and clear join for this ?!)
  • Loading branch information
claudyus committed Feb 25, 2011
1 parent 16d2072 commit c778b05
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions htdocs/data.php
Expand Up @@ -59,19 +59,7 @@
$result = mysql_query ($query, $connection) or die (mysql_error());

while ($row = mysql_fetch_assoc($result)) {
$query = "SELECT nodeName FROM " . MYSQL_NODES_TABLE . " WHERE id = '" . $row['node1'] . "'";
$node_result = mysql_query ($query, $connection) or die (mysql_error());
$node1row = mysql_fetch_row($node_result);
$node1name = htmlspecialchars($node1row[0]);

$query = "SELECT nodeName FROM " . MYSQL_NODES_TABLE . " WHERE id = '" . $row['node2'] . "'";
$node_result = mysql_query ($query, $connection) or die (mysql_error());
$node2row = mysql_fetch_row($node_result);
$node2name = htmlspecialchars($node2row[0]);
$type = htmlspecialchars($row['type']);
$quality = htmlspecialchars($row['quality']);

echo "<link node1=\"" . $node1name . "\" node2=\"" . $node2name . "\" type=\"" . $type . "\" quality=\"" . $quality . "\" />\n";
echo "<link node1=\"" . $row['node1'] . "\" node2=\"" . $row['node2'] . "\" type=\"" . $row['type'] . "\" quality=\"" . $row['quality'] . "\" />\n";
}

echo "</links>";
Expand Down

0 comments on commit c778b05

Please sign in to comment.