MySQL Database Php



db Field Finder


/*
CREATE TABLE tabs(db varchar(120) NOT NULL,tabs varchar(120) NOT NULL,fld varchar(120) NOT NULL)
*/
$dbn="test";//do the bit
$table="tabs";//do th bit
@mysql_connect("Heavenlyhost","UserBlame","aBsuRd");//do h bit
function bold($b,$name){$b=eregi_replace("$name","$name",$b);return($b);}
$nb="?|?";
echo"

db Field Finder - switched off for obvious reasons.......




Type a single word Phrase
";
if(!$field_name){return;}
@$db=mysql_list_dbs();
while(@$dbs=mysql_fetch_array($db))
{
$lt=mysql_list_tables($dbs[0]);
while($tabs=mysql_fetch_array($lt))
{
$lf=mysql_list_fields($dbs[0],$tabs[0]);
$f=mysql_num_fields($lf);
for($i=0;$i<$f;$i++)
{
if(mysql_field_name($lf,$i)==$field_name)
{
$fn=mysql_field_name($lf,$i);
$sql_query = "insert into $table values('$dbs[0]','$tabs[0]','$fn')";
echo"Field \"$field_name\" is in
Database [$dbs[0] ]
Table [ $tabs[0] ]
";
echo$nb; echo mysql_field_type($lf,$i);echo$nb;echo mysql_field_len($lf,$i);echo$nb;
echo mysql_field_flags($lf,$i);
echo"
";
}
else
{
$fn=mysql_field_name($lf,$i);
$sql_query = "insert into $table values('$dbs[0]','$tabs[0]','$fn')";
$res= mysql_db_query($dbn, $sql_query);
}
}
}
}
echo"

";
$last="select fld,tabs,db from $table where fld like '%$field_name%' order by db,tabs,fld";
@$results = mysql_db_query($dbn, $last);
while(@$d=mysql_fetch_array($results))
{
echo"Search for \"$field_name\"
is part of a fieldname in Database [ $d[db] ]
Table [ $d[tabs] ]
";
echo $field_name2=$b=bold($d[fld],$field_name);
echo"
";
}
$del_query="delete from $table";
@$del = mysql_db_query($dbn, $del_query);
@mysql_close();
?>


Programming ?