Ich versuche, eine Website zu machen, dass, wenn Sie auf die Anwendung klicken, öffnet es und es funktioniert im Moment, aber öffnet jede einzelne Anwendung, die offensichtlich will ich nicht.PHP - While Loop Query
Ich glaube, ich muss eine foreach loop so for every application it puts a different
$ appLocation `in?
Dies ist nur ein erstes Projekt für mich, also vielleicht, wenn mir jemand in die richtige Richtung zeigen kann.
<?php
$appQuery = "SELECT app_name, app_location, app_status, app_image FROM applications";
$select_posts = mysqli_query($conn, $appQuery);
if ($result = mysqli_query($conn, $appQuery)) {
/* fetch associative array */
while ($row = mysqli_fetch_assoc($result)) {
$appName = $row['app_name']; // List Application Name
$appLocation = $row['app_location']; // List Application Location
$appStatus = $row['app_status']; // List Application Status - 1 = Enabled/0 = Disabled
$appImage = $row['app_image']; // List Application Image Locations
?>
<!-- Tile with image container -->
<div class="tile">
<div class="tile-content">
<div class="image-container">
<form method="post">
<div class="frame">
<button name="appButton"><img src="<?php echo $appImage ?>"></button>
</div>
</form>
<?php
if (isset($_POST['appButton'])) {
exec("start $appLocation");
}
?>
</div>
</div>
</div>
<?php
}
?>
zunächst eingedenk - laufen nicht die Abfrage zweimal, entfernen Sie '$ select_posts = mysqli_query ($ conn, $ appQuery);' Und da die Buttons alle gleich benannt sind, wird das Klicken auf eines von ihnen ALLE Apps veranlassen, – RamRaider