Treceți la conținutul principal

read any mysql database with this php code

//db.php
<?php
error_reporting(E_ALL);

$link = mysql_connect('localhost', 'root', '');
$db_list = mysql_list_dbs($link);

$i = 0;
$cnt = mysql_num_rows($db_list);
echo "<table>";
while ($i < $cnt) {
    echo "<tr><td><a href='table.php?dbname=".mysql_db_name($db_list, $i)."'>".mysql_db_name($db_list, $i) ."</a></td></tr>";
    $i++;
}
echo "</table>";
?>



//dbs.php
  <link rel="stylesheet" type="text/css" href="style.css" />
<?php
error_reporting(E_ALL);

$link = mysql_connect('localhost', 'root', '');
$db_list = mysql_list_dbs($link);

$i = 0;
$cnt = mysql_num_rows($db_list);
echo "<table>";
while ($i < $cnt) {
    echo "<tr><td><a href='tables.php?dbname=".mysql_db_name($db_list, $i)."'>".mysql_db_name($db_list, $i) ."</a></td></tr>";
    $i++;
}
echo "</table>";
?>

//field.php
<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
    die('Could not connect to MySQL server: ' . mysql_error());
}
$dbname = $_GET['dbname'];
$tablename = $_GET['tablename'];
$db_selected = mysql_select_db($dbname, $link);
if (!$db_selected) {
    die("Could not set $dbname: " . mysql_error());
}
$sqlQuery = "select * from ".$tablename;
$res = mysql_query($sqlQuery, $link);
$i = 0;

echo "<table><tr>";
echo "<th>column</th>";
echo "<th>blob</th>";
echo "<th>max_length</th>";
echo "<th>multiple_key</th>";
echo "<th>name </th>";
echo "<th>not_null</th>";
echo "<th>numeric </th>";
echo "<th>primary_key</th>";
echo "<th>table </th>";
echo "<th>type</th>";
echo "<th>unique_key</th>";
echo "<th>unsigned</th>";
echo "<th>zerofill</th>";
echo "</tr>";

while ($i < mysql_num_fields($res)) {


    $meta = mysql_fetch_field($res, $i);
    if (!$meta) {
        echo "No information available<br />\n";
    }



echo "<tr><td>".$i."</td>";
echo "<td>".$meta->blob."</td>";
echo "<td>".$meta->max_length."</td>";
echo "<td>".$meta->multiple_key."</td>";
echo "<td><a href='record.php?tablename=".$tablename."&dbname=".$dbname."&fieldname=".$meta->name."'>".$meta->name."</a></td>";
echo "<td>".$meta->not_null."</td>";
echo "<td>".$meta->numeric."</td>";
echo "<td>".$meta->primary_key."</td>";
echo "<td>".$meta->table."</td>";
echo "<td>".$meta->type."</td>";
echo "<td>".$meta->unique_key."</td>";
echo "<td>".$meta->unsigned."</td>";
echo "<td>".$meta->zerofill."</td>";
echo "</tr>";

    $i++;
}
echo "</table>";
mysql_free_result($res);
?>



//fields.php
<link rel="stylesheet" type="text/css" href="style.css" />
<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
    die('Could not connect to MySQL server: ' . mysql_error());
}
if(isset($_GET['dbname'])){

$dbname = $_GET['dbname'];
}
else
{
$dbname = $_POST['dbname'];
}

if(isset($_GET['tablename'])){
$tablename = $_GET['tablename'];
}
else
{
$tablename = $_POST['tablename'];
}


$db_selected = mysql_select_db($dbname, $link);
if (!$db_selected) {
    die("Could not set $dbname: " . mysql_error());
}
$sqlQuery = "select * from ".$tablename ;
$res = mysql_query($sqlQuery, $link);
$i = 0;


if(isset($_POST['ii'])){
$ii=$_POST['ii'];

if(isset($_POST['Next'])){
 $ii=$_POST['ii']+1;
}
if(isset($_POST['Prev'])){
 $ii=$_POST['ii']-1;
}
}
else
{
$ii=1;
}

 PRINT '<form name="input" action="fields.php" method="POST">';
  PRINT '<input type="text" name="ii" value="'.$ii.'">';
while ($i < mysql_num_fields($res)) {


    $meta = mysql_fetch_field($res, $i);
    if (!$meta) {
        echo "No information available<br />\n";
    }



mysql_select_db($dbname);

$iii=$ii-1;
$fieldname=$meta->name;
$sqlE = "SELECT * FROM ".$tablename." LIMIT ".$iii." ,1";
//$sqlE = "SELECT * FROM ".$tablename." LIMIT 0,1";
$resursaE = mysql_query($sqlE);

 
 PRINT '<b>'.$fieldname.'</b>';

WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<input type="text" name="'.$rowE[$fieldname].'" value="'.$rowE[$fieldname].'">';
  //PRINT '<input type="submit" value="MODIFY">';
  print '<br>';
  }
  
    $i++;
}


PRINT '<BR><hr><input type="text" name="dbname" value="'.$dbname.'"><BR>';
 PRINT '<input type="text" name="tablename" value="'.$tablename.'"><BR>';
  PRINT '<input type="text" name="fieldname" value="'.$fieldname.'"><BR>'; 
  print '<input type="submit" name ="Prev" value="Prev">';
  print '<input type="submit" value="GoTo:">';
  print '<input type="submit" name ="Next" value="Next">';
 PRINT '</form>';
mysql_free_result($res);
?>



//modify.php
<?

mysql_connect("localhost", "root", "");

$dbname = $_POST['dbname'];
$tablename = $_POST['tablename'];
$fieldname = $_POST['fieldname'];
mysql_select_db($dbname);


$sqlE = "SELECT * FROM ".$tablename;
$resursaE = mysql_query($sqlE);

 PRINT '<table class="sortabledraggable">';
 PRINT '<th>'.$fieldname.'</th>';
 PRINT '<form name="input" action="record.PHP" method="get">';
WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<TR><TD><TD> <input type="text" name="'.$rowE[$fieldname].'" value="'.$rowE[$fieldname].'"><input type="submit" value="MODIFY"></TD></tr>';
  
  }
 PRINT '<TR><input type="text" name="dbname" value="'.$dbname.'">';
 PRINT '<input type="text" name="tablename" value="'.$tablename.'">';
 PRINT '<input type="text" name="fieldname" value="'.$fieldname.'"></TR>';
  
  print '</table>';
  
  
 
 
 
 PRINT '</form>';
  
 
  ?>



//modifys.php
<link rel="stylesheet" type="text/css" href="style.css" />
<?

mysql_connect("localhost", "root", "");

$dbname = $_POST['dbname'];
$tablename = $_POST['tablename'];
$fieldname = $_POST['fieldname'];
mysql_select_db($dbname);


$sqlE = "SELECT * FROM ".$tablename;
$resursaE = mysql_query($sqlE);

 PRINT '<table class="sortabledraggable">';
 PRINT '<th>'.$fieldname.'</th>';
 PRINT '<form name="input" action="records.PHP" method="get">';
WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<TR><TD><TD> <input type="text" name="'.$rowE[$fieldname].'" value="'.$rowE[$fieldname].'"><input type="submit" value="MODIFY"></TD></tr>';
  
  }
 PRINT '<TR><input type="text" name="dbname" value="'.$dbname.'">';
 PRINT '<input type="text" name="tablename" value="'.$tablename.'">';
 PRINT '<input type="text" name="fieldname" value="'.$fieldname.'"></TR>';
  
  print '</table>';
  
  
 
 
 
 PRINT '</form>';
  
 
  ?>




//record.php
<?

mysql_connect("localhost", "root", "");

$dbname = $_GET['dbname'];
$tablename = $_GET['tablename'];
$fieldname = $_GET['fieldname'];
mysql_select_db($dbname);


$sqlE = "SELECT * FROM ".$tablename;
$resursaE = mysql_query($sqlE);

 PRINT '<table class="sortabledraggable">';
 PRINT '<th>'.$fieldname.'</th>';
 PRINT '<form name="input" action="MODIFY.PHP" method="POST">';
WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<TR><TD><TD> <input type="text" name="'.$rowE[$fieldname].'" value="'.$rowE[$fieldname].'"><input type="submit" value="MODIFY"></TD></tr>';
  
  }
 PRINT '<TR><TD><input type="text" name="dbname" value="'.$dbname.'"><br>';
 PRINT '<input type="text" name="tablename" value="'.$tablename.'"><br>';
 PRINT '<input type="text" name="fieldname" value="'.$fieldname.'"><br></TD></TR>';
  
  print '</table>';
  
  
 
 
 
 PRINT '</form>';
  
 
  ?>

//records.php


<link rel="stylesheet" type="text/css" href="style.css" />
<?

mysql_connect("localhost", "root", "");

$dbname = $_GET['dbname'];
$tablename = $_GET['tablename'];
$fieldname = $_GET['fieldname'];
mysql_select_db($dbname);


$sqlE = "SELECT * FROM ".$tablename;
$resursaE = mysql_query($sqlE);

 PRINT '<table class="sortabledraggable">';
 PRINT '<th>'.$fieldname.'</th>';
 PRINT '<form name="input" action="MODIFYs.PHP" method="POST">';
WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<TR><TD><TD> <input type="text" name="'.$rowE[$fieldname].'" value="'.$rowE[$fieldname].'"><input type="submit" value="MODIFY"></TD></tr>';
  
  }
 PRINT '<TR><TD><input type="text" name="dbname" value="'.$dbname.'"><br>';
 PRINT '<input type="text" name="tablename" value="'.$tablename.'"><br>';
 PRINT '<input type="text" name="fieldname" value="'.$fieldname.'"><br></TD></TR>';
  
  print '</table>';
  
  
 
 
 
 PRINT '</form>';
  
 
  ?>



//table.php
<?php
$conn = mysql_connect('localhost', 'root', '');
if (!$conn) {
    die('Could not connect: ' . mysql_error());
}


$dbname = $_GET['dbname'];
echo $dbname;
mysql_select_db($dbname);

$result = mysql_list_tables($dbname);
$num_rows = mysql_num_rows($result);
echo "<table>";
for ($i = 0; $i < $num_rows; $i++) {
    echo "<tr><td><a href='field.php?tablename=".mysql_tablename($result, $i)."&dbname=".$dbname."'>".mysql_tablename($result, $i)."</a></td></tr>";
}
echo "</table>";
mysql_free_result($result);
?>




//tables.php
<link rel="stylesheet" type="text/css" href="style.css" />
<?php
$conn = mysql_connect('localhost', 'root', '');
if (!$conn) {
    die('Could not connect: ' . mysql_error());
}


$dbname = $_GET['dbname'];
echo $dbname;
mysql_select_db($dbname);

$result = mysql_list_tables($dbname);
$num_rows = mysql_num_rows($result);
echo "<table>";
for ($i = 0; $i < $num_rows; $i++) {
    echo "<tr><td><a href='fields.php?tablename=".mysql_tablename($result, $i)."&dbname=".$dbname."'>".mysql_tablename($result, $i)."</a></td></tr>";
}
echo "</table>";
mysql_free_result($result);
?>




Comentarii

Postări populare de pe acest blog

program principal cpp

#include "clasa.h" #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #define DELAY 9000000 void delay() { for(long i=0;i<DELAY;i++); } //constructor cu initializare de la tastatura BigInt::BigInt() {char x; signed char t[400]; int i; printf("\nNumarul cu semn "); do s=getche(); while((s!='+')&&(s!='-')); n=0; do {x=getche(); t[n]=x-'0'; n++; } while((x>='0')&&(x<='9')); n--; for(i=0;i<n;i++) nr[i]=t[n-i-1]; } //constructor cu initializare prin parametri BigInt::BigInt(char semn,signed char numar[],int dim) {int i; s=semn; n=dim; for(i=0;i<n;i++) nr[i]=numar[n-i-1]; } //transform un int negativ in pozitiv int BigInt::Pozitiv(int x) {int a,vb; a=0; vb=0; while(vb==0) if((x+a)==0) vb=1; else a=a+1; x=a; return x; } //constructor dintr-un nr int obisnuit BigInt::BigInt(int x) {int i; if(x>=0) s='+'…

NUMERE PRIME ALGORITM C++

// NUMERE PRIME ALGORITM C++//  reediting from scratch //on this page is just the study for a next algoritm for generating the parime nr series like Fibonnaci or ....if possibile

74111121313417374414124343447 if u know the red part you can generate the orange part
1 0 1 111112222 1 1 23

o aplicatie php localitati romania

//APLICATIA SE REFERA LA BAZA DE DATE SIRUTA

//dragtable.js


/* dragtable v1.0 June 26, 2008 Dan Vanderkam, http://danvk.org/dragtable/ http://code.google.com/p/dragtable/ \Bsortabledraggable\B Instructions: - Download this file - Add <script src="dragtable.js"></script> to your HTML. - Add class="draggable" to any table you might like to reorder. - Drag the headers around to reorder them. This is code was based on: - Stuart Langridge's SortTable (kryogenix.org/code/browser/sorttable) - Mike Hall's draggable class (http://www.brainjar.com/dhtml/drag/) - A discussion of permuting table columns on comp.lang.javascript Licensed under the MIT license. */ // Here's the notice from Mike Hall's draggable script: //***************************************************************************** // Do not remove this notice. // // Copyright 2001 by Mike Hall. // See http…