This is my current code (JS-style, you add as you learn):
<?=
print "Your items: ".
$loot['item_name']; I want to display all of the items from the db-table "game_items"
This is my current code (JS-style, you add as you learn):
<?=
print "Your items: ".
$loot['item_name']; I want to display all of the items from the db-table "game_items"
That looks like PHP not JS:
<?php
echo 'Your Items:';
foreach($loot as $k=>$v){
echo $v['item_name'].'-'.$v['other_field']."<br/>\r\n";
}
?> It is probably PHP, since JS doesn't usally connect to the database unless you are using nodeJS or some back-end implementation of javascript.
I'd have to look up the syntax for JS since I used to program with jQuery all the time.
you can also loop over all the columns in the table if you want, useful for designing the table cause you can see all the columns with their name:
<?php
echo 'Your Items:';
foreach($loot as $k=>$v){
foreach($v as $ke=>$va){
echo $ke.':'.$va.'|';
}
echo "<br>\r\n";
}
?>We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.