Sponsor-Board.de

Normale Version: PHP+MySQL hilfe benötigt
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Hallo liebe SB'ler,

Ich bräuchte hilfe bei einer Datenbankabfrage.

Ich möchte gerne, dass wenn man eine ID in eine Textbox eingibt alle zugehörigen Daten aus einer MySQL-Datenbank abgerufen werden.
Ich habeschon nach gegooglet und leider nichts gefunden.

Es ist für eine Stats-Anzeige für meinen Gameserver.
In der Datenbank werden bestimmte Daten über ein Skill-System gespeichert und ich möchte, dass die User sich direkt ihre Skills anschauen können wenn sie ihren InGame-Namen oder ihre UserID angeben.

Aktueller Stand:
[Link: Registrierung erforderlich]

Als gegenleistung kann ich einen Banner auf der Website anzeigen lassen und einen kleinen Text im Footer.

Danke im vorraus.

LG z0cky
Mach mal n Screenshot von der Datenbank, oder poste die Struktur.
Dann noch dann bisherigen Code / deine Versuche Smile
Der bisherige Code besteht aus 3 Dateien:
footer.php
index.php
konfiguration.php

Wichtig wäre nur die index.php:

PHP-Code:
<html>
<
head>
<
title>Rust4You Stats</title>

<!-- 
Latest compiled and minified CSS -->
<
link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

<!-- 
jQuery library -->
<
script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

</head>
<body>
<nav class="navbar navbar-inverse">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">Rust4You Stats-Page</a>
    </div>
    <ul class="nav navbar-nav">
      <li class="active"><a href="#">Home</a></li>
      <li><a href="http://Rust4You.de/" target="_blank">Forum</a></li>
    </ul>
  </div>
</nav>
<?php
require_once ('konfiguration.php');
$db_link mysqli_connect (
                     
MYSQL_HOST
                     
MYSQL_BENUTZER
                     
MYSQL_KENNWORT
                     
MYSQL_DATENBANK
                    
);
 
$sql "SELECT * FROM RPG_User";
 
$db_erg mysqli_query$db_link$sql );
if ( ! 
$db_erg )
{
  die(
'Ung&uuml;ltige Abfrage: ' mysqli_error());
}

echo 
'
    <div class="well well-lg">
    <center>
    <table border="1">
    <tr>
    <th>&nbsp;User-ID&nbsp;</th>
    <th>&nbsp;User-Name&nbsp;</th>
    <th>&nbsp;Woodcutting-LVL&nbsp;</th>
    <th>&nbsp;Mining-LVL&nbsp;</th>
    <th>&nbsp;Skinning-LVL&nbsp;</th>
    <th>&nbsp;Crafting-LVL&nbsp;</th>
    </tr>
    '
;

while (
$zeile mysqli_fetch_array$db_ergMYSQL_ASSOC))
{
  echo 
"<tr>";
  echo 
"<td>&nbsp;"$zeile['UserID'] . "&nbsp;</td>";
  echo 
"<td>&nbsp;"$zeile['Name'] . "&nbsp;</td>";
  echo 
"<td>&nbsp;"$zeile['WCLevel'] . "&nbsp;</td>";
  echo 
"<td>&nbsp;"$zeile['MLevel'] . "&nbsp;</td>";
  echo 
"<td>&nbsp;"$zeile['SLevel'] . "&nbsp;</td>";
  echo 
"<td>&nbsp;"$zeile['CLevel'] . "&nbsp;</td>";
  echo 
"</tr>";
}
echo 
'</table>
    <br />
    <button type="button" class="btn btn-info" onclick="window.location.reload();"><span class="glyphicon glyphicon-refresh"></span> REFRESH</button>
    </div>
    </center>'
;
 
mysqli_free_result$db_erg );

include 
"footer.php";

?>
</body>
</html> 


Datenbank-Struktur:
[Link: Registrierung erforderlich]

Der SQL-Code:

Code:
CREATE TABLE `RPG_User` (
  `UserID` bigint(20) NOT NULL,
  `Name` varchar(50) DEFAULT NULL,
  `WCLevel` int(11) DEFAULT NULL,
  `WCPoints` bigint(20) DEFAULT NULL,
  `MLevel` int(11) DEFAULT NULL,
  `MPoints` bigint(20) DEFAULT NULL,
  `SLevel` int(11) DEFAULT NULL,
  `SPoints` bigint(20) DEFAULT NULL,
  `CLevel` int(11) DEFAULT NULL,
  `CPoints` bigint(20) DEFAULT NULL,
  `LastDeath` int(11) DEFAULT NULL,
  `LastLoginDate` int(11) DEFAULT NULL,
  `XPMultiplier` int(11) NOT NULL DEFAULT '100'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

pushmessage
pushmessage
Referenz-URLs