summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcos <cos>2015-10-03 22:15:08 +0200
committercos <cos>2015-10-03 22:15:08 +0200
commit7ccd884b6d57e84df601e689336479a74b913ce2 (patch)
tree4d1e21b8c529966b48ed42cb07ce216a1b8c3163
parent50bfecf318df7c4a2d008d18c496a2058d6789e2 (diff)
downloadmat-7ccd884b6d57e84df601e689336479a74b913ce2.zip
mat.cgi: Output weight & energy.
-rwxr-xr-xcgi-bin/mat.cgi8
1 files changed, 5 insertions, 3 deletions
diff --git a/cgi-bin/mat.cgi b/cgi-bin/mat.cgi
index 793671a..d61db32 100755
--- a/cgi-bin/mat.cgi
+++ b/cgi-bin/mat.cgi
@@ -50,11 +50,13 @@ sub cmd_view($)
my $db = DBI->connect($Config{'database'}, "", "",
{HandleError => \&misconfigured, AutoCommit => 1});
- my $recipe_row = $db->selectrow_arrayref("SELECT name, storage, uri FROM ".
- "recipes AS r JOIN inventory AS i ON i.recipe_id=r.id WHERE i.id=".$id.
- ";");
+ my $recipe_row = $db->selectrow_arrayref("SELECT name, storage, uri, ".
+ "amount, energy FROM recipes AS r JOIN inventory AS i ".
+ "ON i.recipe_id=r.id WHERE i.id=".$id.";");
print $id, "<br />", $$recipe_row[0], "<br />", $$recipe_row[1], "<br />";
+ print ($$recipe_row[3] ? $$recipe_row[3]." g<br />" : ""), "<br />";
+ print ($$recipe_row[4] ? $$recipe_row[4]." kJ<br />" : ""), "<br />";
if(substr($$recipe_row[2], 0, 4) eq "http") {
print '<a href="'.$$recipe_row[2].'">'.$$recipe_row[2].'</a>', "<br />";
} else {