Thema: Mysql und Php
Einzelnen Beitrag anzeigen
Ungelesen 27.01.11, 16:40   #4
Irolight
Newbie
 
Registriert seit: Feb 2010
Beiträge: 70
Bedankt: 7
Irolight leckt gerne myGully Deckel in der Kanalisation! | 496004 Respekt PunkteIrolight leckt gerne myGully Deckel in der Kanalisation! | 496004 Respekt PunkteIrolight leckt gerne myGully Deckel in der Kanalisation! | 496004 Respekt PunkteIrolight leckt gerne myGully Deckel in der Kanalisation! | 496004 Respekt PunkteIrolight leckt gerne myGully Deckel in der Kanalisation! | 496004 Respekt PunkteIrolight leckt gerne myGully Deckel in der Kanalisation! | 496004 Respekt PunkteIrolight leckt gerne myGully Deckel in der Kanalisation! | 496004 Respekt PunkteIrolight leckt gerne myGully Deckel in der Kanalisation! | 496004 Respekt PunkteIrolight leckt gerne myGully Deckel in der Kanalisation! | 496004 Respekt PunkteIrolight leckt gerne myGully Deckel in der Kanalisation! | 496004 Respekt PunkteIrolight leckt gerne myGully Deckel in der Kanalisation! | 496004 Respekt Punkte
Standard

Ok das müsste so in etwas funktionieren, es biete zwar noch platz für Optimierungen hat aber die Grundfunktionen. $Tabelle ist quasi deine Suche Eingabe (es wäre nicht Verkehrt vorher zu überprüfen ob es sich nur im ein Wort handelt)

PHP-Code:
<?php
$link 
mysql_connect('localhost''mysql_user''mysql_password') or die('keine Verbindung möglich: ' mysql_error());
mysql_select_db('meineDatenbank'$link) or die('Datenbank konnte nicht erreicht werden: ' mysql_error());

$SQL "SELECT * FROM "  $Tabelle;

$query_result mysql_query ($SQL);

$results = array();

while(
$results[] = mysql_fetch_assoc($result)); // $results ist ein Assozatives Array mit der Kompletten Tabelle

mysql_close($link);




// Ausgabe
if(count($results) > 0) {
    echo 
"<table>";
    echo 
"<tr>";
        foreach(
$results[0] as $content_detailName => $content_detail) {
            echo 
"<th>" $content_detailName "</th>";
        }
    
    echo 
"</tr>";

    foreach(
$results as $content) {
    
        echo 
"<tr>";
        foreach(
$content as $content_detail) {
            echo 
"<td>" $content_detail "</td>";
        }
    
        echo 
"</tr>";
    }
    echo 
"</table>";
}

?>
Irolight ist offline   Mit Zitat antworten