Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Show table

  1. #1

    Show table

    Ho queste istruzioni (più o meno) in una classe:

    $query=mysql_query("SHOW TABLE STATUS FROM {$db_name}");
    while ($database=mysql_fetch_assoc($query)) {
    echo $database['Name'].'
    ';
    }

    Vorrei limitare quella istruzione ad una sola tabella ed ho scritto:

    $query=mysql_query("SHOW TABLE STATUS FROM {$db_name} WHERE Name='mia_tabella'");
    while ($database=mysql_fetch_assoc($query)) {
    echo $database['Name'].'
    ';
    }

    Mi restituisce il seguente errore:

    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /web/htdocs/xxxxxx/home/administration/xxxxx/xxxxxx.php on line 10


    Mi aiutate? vi prego
    Prima o poi anch'io vi insegnerò qualcosa

  2. #2
    Più nello specifico:

    Questa funzione aggiunge tutte le tabelle del database:


    function dump_database($dbname, $reset_anyway=TRUE, $dump_data=TRUE) {//*

    // Check for empty dbname
    if (!isset($dbname) || !$dbname) {

    // if yes exit
    return FALSE;
    }

    // Try to set SELECTED DB
    if (!$this->select_db($dbname, $reset_anyway)) {

    // if fail get out
    return FALSE;
    }

    // List tables
    $query = mysql_query("SHOW TABLE STATUS FROM {$dbname}");


    // Cicle results
    $key = "";
    while ($database = mysql_fetch_assoc($query)) {
    // Add Tables
    $key=count($this->_TABLES);
    $this->_TABLES[$key]['nome'] = $database["Name"];
    $this->_TABLES[$key]['params'] = "";
    $this->_TABLES[$key]['dump_data'] = $dump_data;
    }

    // All ok...return TRUE
    return TRUE;
    }

    Vorrei modificarla in modo che venga aggiunta solo una tabella che io gli comando, mettendola nei parametri fra parentesi.
    Prima o poi anch'io vi insegnerò qualcosa

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.