I have set up a MySql database containing several tables (needed for uploading tons of data that is entered in excel). I would like to use each table name as a variables that automatically updates each time a new table is added to the database. However, I don't know how to prevent PHP from overwriting my $tableName variable in loops. This is what I got so far:

```
        <?php

            if (!mysql_connect($host, $username, $password)) {
                echo 'Could not connect to mysql';
                exit;
            }

            $sql = "SHOW TABLES FROM $database";
            $result = mysql_query($sql);

            if (!$result) {
                echo "DB Error, could not list tables\n";
                echo 'MySQL Error: ' . mysql_error();
                exit;
            }

            while ($row = mysql_fetch_row($result)) {
                $tableName = $row[0];
                include('../design.php');
            }

        ?>

```

In other words: On the frontpage of the website I would like to include data from every single database table. I have organized a framework for extracting that data and presenting it neatly in design.php. However, this file makes use of the $tableName variable for extracting the data and I think that variable is being overwritten at each loop causing the error (only the number one table will be displayed).

Instead, if I just separate the code in their own php objects, then everything works just fine:

```
        <?php
            $tableName = tablename1;
            include('../design.php');
        ?>
        <?php
            $tableName = tablename2;
            include('../design.php');
        ?>
        etc..

```

Can anyone explain to me how this works? Or if there is some smarter way of doing things?

Thanks in advance!