//列出所有資料庫

$result =mysql_list_dbs($localmat);

while ($row = mysql_fetch_object($result)) {

echo "資料庫:";

echo $row->Database . "\n";

}

echo "
";





//資料庫名稱,列出所有table

if ($dname!="")

{

$result =mysql_list_tables($dname);

echo $dname."的table
";

while ($row = mysql_fetch_row($result)) {

print "Table: $row[0]\n";

}

}

echo "
";







//table名稱,列出所有欄位

if ($tname!="")

{

mysql_select_db($dname, $localmat);

$result = mysql_query("select * from $tname", $localmat);

echo mysql_error();

//劃出欄位名稱

echo "";

$i=0;

echo "";



do {

echo "" ;

} while ($i < @mysql_num_fields ($result)) ;

echo "
表格:$tname ";

$i++;

$meta = @mysql_fetch_field ($result);

echo $meta->name."
";

}

echo "
";







$sname=strtolower($sname);

if ($sname!="")

{

mysql_select_db($dname, $localmat);

$result = mysql_query($sname, $localmat);

echo mysql_error();



//echo $localmat;

}

$aa=explode(" ", $sname);

switch ($aa[0]) {

case 'insert':

$try="into";

break;

case 'update':

$try="update";

break;

case 'delete':

$try="from";

break;

default :

$try="select";

break;

}

echo $sname."字串長度
";

//echo $try."驗證
";

$str1=substr($sname,strpos( $sname, $try ));

$str2=explode(" ", $str1);



if ($try!="select" and $try!="") $sname="select * from ".$str2[1]." where 1";

//echo $sname;



if ($sname!="" and $dname!="") {

mysql_select_db($dname, $localmat);

$result = mysql_query($sname, $localmat);

echo mysql_error();



//劃出欄位名稱

echo "";

$i=0;

do {

echo "" ;

} while ($i < @mysql_num_fields ($result)) ;



do {

echo "";

for ($j=0;$j<$i;$j++) echo "";

echo "";



} while (@$row_Recordset1 = mysql_fetch_row($result)) ;



echo "
$i";

$i++;

$meta = @mysql_fetch_field ($result);

echo $meta->name."
$row_Recordset1[$j]
";

}

?>













無標題文件











arrow
arrow
    全站熱搜
    創作者介紹
    創作者 killworm737 的頭像
    killworm737

    紀錄些小事情

    killworm737 發表在 痞客邦 留言(0) 人氣()