'') { $dbtable=$_REQUEST['dbtable']; if (array_key_exists($dbtable, $tablesDisp)) { $tmp=explode('.', $dbtable); $database = $tmp[0]; $table = $tmp[1]; $sessionPage=$database.'.'.$table; $_SESSION['dbtable'] = $sessionPage; } else die("Table '$dbtable' inconnue !"); } if ($sessionPage=='') { $sessionPage=$dbtable=qssession('dbtable'); $tmp=explode('.', $sessionPage); $database = $tmp[0]; $table = $tmp[1]; } $host = "192.168.3.22:3306"; $user = "root"; $passwd = "bzh4231*"; $link = @mysql_connect($host,$user,$passwd); @mysql_select_db($database); $fields_hidden=$fields_readOnly=$fields_nomChamps=$fields_links=$fields_libs=array(); if (isset($tablesInfo[$dbtable]['fields_hidden'])) $fields_hidden=$tablesInfo[$dbtable]['fields_hidden']; if (isset($tablesInfo[$dbtable]['fields_readOnly'])) $fields_readOnly=$tablesInfo[$dbtable]['fields_readOnly']; if (isset($tablesInfo[$dbtable]['fields_nomChamps'])) $fields_nomChamps=$tablesInfo[$dbtable]['fields_nomChamps']; if (isset($tablesInfo[$dbtable]['fields_links'])) $fields_links=$tablesInfo[$dbtable]['fields_links']; if (isset($tablesInfo[$dbtable]['fields_libs'])) $fields_libs=$tablesInfo[$dbtable]['fields_libs']; if (isset($tablesInfo[$dbtable]['titres'][$page])) $titre=$tablesInfo[$dbtable]['titres'][$page]; $row = ""; $err_string = ""; $quotechar = "`"; $quotedate = "'"; $sql = ""; $sql_ext = ""; $sqlmaster = ""; $sql_extmaster = ""; $cellvalue = ""; $istrdata = ""; $icon = ""; $ioldcon = ""; $strkeyword = ""; $sortstring = ""; $parammaster = array(); $fields = array(); $fieldcons = array(); $searchmode = array(); $stdsearchopt = array(); $isEditables = array(); $formatdate = array(); $seperatedate = array(); $format = array(); $champ = array(); $long =array(); $formatEnum=array(); $primary_keys=array(); $arryitemvalue = array(); $arryopt = array(); $arryandoropt = array(); $result = mysql_query("SHOW COLUMNS FROM $table"); if (!$result) { echo 'Impossible d\'exécuter la requête : ' . mysql_error(); exit; } if (mysql_num_rows($result) > 0) { $sql .= "SELECT "; $i=0; while ($row = mysql_fetch_assoc($result)) { $sql .= " $table.`".$row['Field'].'`,'; $fields[$i]=$table.'.`'.$row['Field'].'`'; $fieldcons[$i]=$table.'.`'.$row['Field'].'`'; $parammaster[$i]=''; $arryitemvalue[$i]=''; $arryopt[$i]=''; $arryandoropt[$i]=''; $searchmode[$i]= 0; $stdsearchopt[$i]=0; $champ[$i]['nom']=$row['Field']; // Le champ est il caché ? if (in_array($row['Field'], $fields_hidden)) $champ[$i]['hidden']=true; else $champ[$i]['hidden']=false; // Le champ est il éditable ? $isEditables[$i] = true; if (in_array($row['Field'], $fields_readOnly) || @$tablesInfo[$dbtable]['table_readOnly']) $isEditables[$i] = false; // Le champ comporte il un lien ? $champ[$i]['link'] = ''; if (isset($fields_links[$row['Field']]) && $fields_links[$row['Field']]<>'') $champ[$i]['link']=$fields_links[$row['Field']]; $champ[$i]['libs'] = ''; if (isset($fields_libs[$row['Field']]) && $fields_libs[$row['Field']]<>'') $champ[$i]['libs']=$fields_libs[$row['Field']]; /* =>array( 'typeEven'=>array('table'=>'jo.tabEvenements', 'key'=>'codEven', 'lib'=>'libEven')),*/ $champ[$i]['type']=$row['Type']; $champ[$i]['null']=$row['Null']; $champ[$i]['key']=$row['Key']; if ($row['Key']=='PRI') $primary_keys[$row['Field']]=$i; $champ[$i]['default']=$row['Default']; $champ[$i]['extra']=$row['Extra']; $champ[$i]['align']='Default'; // right, left $formatdate[$i] = ''; $seperatedate[$i] = ''; if (preg_match('/(timestamp|date|datetime)(.*)/i', $row['Type'], $matches)) { $formatdate[$i] = 'dd/mm/yyyy'; $seperatedate[$i] = '/'; $format[$i] = 'date'; } elseif (preg_match('/(tinyint|smallint|mediumint|int|bigint|integer)(.*)/i', $row['Type'], $matches)) { $tmp=explode(')',$matches[2]); $format[$i]='int'; $long[$i]=trim(str_replace('(','', $tmp[0])); } elseif (preg_match('/(float|double|real|decimal|numeric)(.*)/i', $row['Type'], $matches)) $format[$i] = 'float'; elseif (preg_match('/(char|varchar)(.*)/i', $row['Type'], $matches)) { $tmp=explode(')',$matches[2]); $format[$i]='char'; $long[$i]=trim(str_replace('(','', $tmp[0])); } elseif (preg_match('/(text|tinytext|mediumtext|longtext)(.*)/i', $row['Type'], $matches)) { $format[$i]='text'; } elseif (preg_match('/(enum)(.*)/i', $row['Type'], $matches)) { $format[$i]='enum'; $formatEnum[$i]=explode("','",str_replace(array("('", "')"), '', $matches[2])); } else die ('Format "'.$row['Type'].'" inconnu'); //enum('A','B','C') if (isset($fields_nomChamps[$row['Field']]) && $fields_nomChamps[$row['Field']]<>'') $champ[$i]['libelleColonne']=$fields_nomChamps[$row['Field']]; else $champ[$i]['libelleColonne']=$row['Field']; //$fields_nomChamps $i++;/*Array'fields_libs' =>array( 'typeEven'=>array('table'=>'jo.tabEvenements', 'key'=>'codEven', 'lib'=>'libEven')), ( [Field] => numMand [Type] => mediumint(9) [Null] => NO [Key] => PRI [Default] => [Extra] => auto_increment ) 1*/ } $sql_select = substr($sql,0,-1) . " FROM $table $table\n"; $sql = substr($sql,0,-1) . " FROM $table $table\n"; //die(print_r($champ)); } ?>