Problem with the code
| From: | Mulley, Nikhil | Date: | Thu, 09 Sep 2004 21:33:50 +0000 |
| Subject: | Problem with the code | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-196265@lists.php.net to get a copy of this message | ||
Hi All,
I have a problem...with my code ,can any one please guide or correct me.
[BLUE]
My main aim is to develop a php(or php in html) ,in which Login is there ,after appropriate login
,User must get the
Option of selecting available databases ,Upon selecting databases,user must get to select the
appropriate tabl from Selected database,
Can I have that code.
Please do the needful.
[BLUE]
Please find the questions in blue format ....
authenticate.php (should be login.php no probs but)
<?php
include("phpscripts/draw_table.php");
$hostname="xxx";
$usrname=$_POST['username'];
$usrname="root";
$pswd=$_POST['password'];
$db_selected;
$db_list;
$row;
$dbconnlink=mysql_connect($hostname,$usrname,$pswd);
if($dbconnlink) {
echo "<h4><b>Connected to the MYSQL Server : $hostname
</b><h4><br>";
$db_list = mysql_list_dbs($dbconnlink);
echo "<h4>The Databases available in $hostname are :</h4>";
while ($GLOBALS["row"] = mysql_fetch_object($db_list)) {
// echo $row->Database . "\n";
echo "<form METHOD=\"POST\" action=<?php show_table($row->Database);
?><p>
<input type=\"radio\" name=\"Database_Selection\"
value=\"$row\"> $row->Database
</p>
[BLUE] I am listing the available databases here present in the mysql server 'xxx'
I want the user to select the database available ,upon the submit of selection of database,User must
be able to see the available tables in that selected database
Again in the same format of Radio Options to select the table,He must be able to select the
table,Upon selecting particular available table,he must be able to see the
Values in it.
[BLUE]
<br>" ;
echo "Testing";
$selectcat=$row["category"];
echo "<option value=\"$selectcat\">$selectcat</option>
<br>";
//To List all the Databases present in $hostname
}
echo "<BR><INPUT TYPE=\"reset\" VALUE=\"Clear\">
<INPUT TYPE=\"submit\" VALUE=\"Select\"> ";
[BLUE]Can I have here to put the value as dynamic database.[/BLUE]
mysql_free_result($row);
} else {
echo "<b>Error : ".mysql_error()."</b><br>"."<b>
<pre>
Go Back and type the Exact User ID and Password Which mySQL Admininistrator Gave You,
if not available,Please contact <a href = \"xxx@xyz.com systems@hyd.corp.int.untd.com <mailto:systems@hyd.corp.int.untd.com\>
</pre>
<script language=\"javascript\">
javascript.alert(\"Go Back and type the Login Information Correctly\");
</script>
<br>
</b>";
}
function show_table() {
$tableselected='';
$tableselected= $_POST[$row->Database];
}
?>
Thanks,
Nikhil.