Hey,

I'm trying to create a table based on user configurations (saved in mysql db). The 
user is able to filter the table view to only the columns he needs.

The tables are setup like this:
each season has its own table.
config table
currentseason table

Each column in the season table = row in the config table.
The config table has 3 columns: field_name, show_field, display.
The field name is filled with each column's in the season table.

Here's kinda what I'm trying to do (not working of course).

<?php

//current season
    $connect = mysql_connect($host, $login, $passwd);
    mysql_select_db($db);
    $sql = mysql_query ("SELECT seasons FROM currentseason WHERE currentseason=1;");
    $seasonarray = mysql_fetch_array($sql, MYSQL_ASSOC);
    $season = $seasonarray["seasons"];

    $sql_uc = mysql_query("SELECT * FROM config WHERE showfield=1");
    $test = mysql_fetch_array($sql_uc, MYSQL_ASSOC);

    if(is_array($test))
    {
        mysql_query = ("select");
        while ($result = mysql_fetch_array($sql_uc, MYSQL_ASSOC)
        {
            mysql_query .= (" ". $season .".".$result['field_name']." as 
".$result['display'].",";
        }
        
        mysql_query .= ("from ".$season.";");
    }

    else
    {
        die();
    }

Reply via email to