All pastes #79488 Raw Edit

Mine

public php v1 · immutable
·published 2006-07-05 12:45 UTC
rendered paste body
 //for all tables        for($i=0 ; $i<=($table_count-1) ; $i++) {                //get fields                $query = sprintf("SHOW COLUMNS FROM %s",                 mysql_real_escape_string( $mantis_db_tables[$i] ) );                $result = db_query( $query );                while( $column_name = $result->FetchRow() ) {                        $column_names[] = current( $column_name) ;                }                if( array_search('project_id',$column_names) != NULL ) {                        $project_id_tables[] = $mantis_db_tables[$i];                }        }        print_r($project_id_tables);        $project_id_tables_size = sizeof($project_id_tables);        //get the project_id field        for( $i=0 ; $i<= ( $project_id_tables_size-1 ) ; $i++ ) {                print("The table name is ".$project_id_tables[$i]."<BR>" );                $query = sprintf("SELECT * FROM %s WHERE 'project_id'='%s'",                 mysql_real_escape_string( $project_id_tables[$i] ),                 mysql_real_escape_string( $project_id ) );                $result = db_query( $query );                while( $entry = $result->FetchObject() ) {                       print_r( current($entry) );                }}