Beispiel #1
0
function liste_table($attributs){
    $result1 = execute_req('SHOW TABLES');
    echo "<select id='table_$attributs' name='table_$attributs' class='table_relation' table='$attributs'>";
    $i=0;
    foreach ($result1 as $database1) {
        $i+=1;
        if ($i!=1){
            echo '<option value="'.$database1[0].'">'.$database1[0].'</option>';
        }
        else{
            echo '<option selected="selected" value="'.$database1[0].'">'.$database1[0].'</option>';
        }
    }
    echo '</select>';
}
Beispiel #2
0
    public function recuperation_auto(){
        $result = execute_req('SHOW TABLES');
        foreach ($result as $table) {
            $newtable = new table(array('nom'=>$table[0], 'nom_cle'=>$this->nom_cle_tables,'base'=>$this));
            $newtable->recuperation_auto();
            $this->ajouter_table($newtable);
        }

        $position = $this->infos_cle_etrangere['position'];
        $cle_chaine = $this->infos_cle_etrangere['chaine'];
        foreach ($this->tables as $table) {
            $i=-1;
            if ($position!='aucune') foreach ($table->_attributs as $att) {
                $i+=1;
                if ($position=='debut'){
                    if (substr($att->nom, 0, strlen($cle_chaine))==$cle_chaine){
                        $j=-1;
                        foreach ($this->tables as $table1) {
                            $j+=1;
                            if ($table1->nom==substr($att->nom,strlen($cle_chaine))) {
                                $table->_attributs[$i]->etrangere_table=$table1;
                                $this->tables[$j]->relations_n[] = array('nom'=>$table->nom, 'attribut'=>$att->nom);
                            }
                        }
                    }
                }else{
                    if (substr($att->nom, strlen($att->nom) - strlen($cle_chaine))==$cle_chaine){
                        $j=-1;
                        foreach ($this->tables as $table1) {
                            $j+=1;
                            if ($table1->nom==substr($att->nom,0,strlen($att->nom) - strlen($cle_chaine))) {
                                $table->_attributs[$i]->etrangere_table=$table1;
                                $this->tables[$j]->relations_n[] = array('nom'=>$table->nom, 'attribut'=>$att->nom);
                            }
                        }
                    }
                }
            }
        }
    }
<?
require_once '../fonctions.php';
if (isset ($_POST['d_host'])){
    $result = execute_req('SHOW DATABASES');
    echo "<select name='basename' id='basename' size='10' style='width:100%'>";
    foreach ($result as $database) {
        echo "<option value='$database[0]'>$database[0]</option>";
    }
    echo "</select>";
}
?>
Beispiel #4
0
<? require_once '../fonctions.php'; ?>
<select id="<?php 
echo $_POST['prefixe'] . "-" . $_POST['d_attr'];
?>
" name="<?php 
echo $_POST['prefixe'] . $_POST['d_attr'];
?>
" >
    <?php 
$result = execute_req('DESC ' . $_POST['d_table']);
$i = 0;
foreach ($result as $database) {
    $i += 1;
    if ($i != 1) {
        echo '<option value="' . $database[0] . '">' . $database[0] . '</option>';
    } else {
        echo '<option selected="selected" value="' . $database[0] . '">' . $database[0] . '</option>';
    }
}
?>
</select>
<?
require_once '../fonctions.php';
if (isset ($_POST['d_host'])){
    $result = execute_req('SHOW TABLES');
    echo "<select id='tablename' name='tablename' size='10' style='width:100%'>";
    foreach ($result as $database) {
        echo "<option value='$database[0]'>$database[0]</option>";
    }
    echo "</select>";
}
?>