Grafische gevorderde |
|
<html>
<head>
<title>
mysql-verzenden
</title>
</head>
<body>
<?php
$host="localhost";
$user="galienmasters";
$password="";
if(@$_GET['form'] == "yes")
{
mysql_connect($host,$user,$password);
mysql_select_db($_POST['database']);
$query = stripSlashes($_POST['query']);
$result = mysql_query($query);
echo "Database Selected: <b>{$_POST['database']}</b><br>
Query: <b>$query</b><h3>Results</h3><hr>";
if($result == 0)
echo "<b>Error ".mysql_errno().": ".mysql_error().
"</b>";
elseif (@msql_num_rows($result) == 0)
echo("<b>Query completed. No results returned.</b><br>");
else
{
echo "<table border='1'>
<thead>
<tr>";
for($i = 0;$i < mysql_num_fields(result);$i++)
{echo "th".mysql_field_name($result,$i).
"</th>";
}
echo " </tr>
</thead>
<tbody>";
for ($i = 0; $i < mysql_num_rows($result);$i++)
{
echo "<tr>";
$row = mysql_fetch_row($result);
for($j = 0;$j<mysql_num_fields($result);$j++)
{
echo("td" . $row[$j] . "</td>");
}
echo "</tr>";
}
echo "</tbody>
</table>";
}
echo "
<hr><br>
<form action=\"{$_SERVER['PHP_SELF']}\" method=\"POST\">
<input type='hidden' name='query' value='$query'>
<input type='hidden' name='database' value={$_POST['database']}>
<input type='submit' name=\"queryButton\" value=\"New Query\">
<input type='submit' name=\"QueryButton\" value=\"Edit Query\">
</form>";
unset($form);
exit();
@$query=stripSlashes($_POST['query']);
if (@$_POST['queryButton'] != "Edit Query")
{
$query = " ";
}
?>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>?form=yes method="post">
<table>
<tr>
<td align=right><b>Type in database name</b></td>
<td><input type="text" name="database" value=<?php echo @$_POST['database'] ?> ></td>
</tr>
<tr>
<td align="right" valign="top">
<b>Type in SQL - query</b></td>
<td><textarea name="query" cols="60" rows="10">
<?php echo $query ?></textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="submit Query"></td>
</tr>
</table>
</form></body></html>
<html> <head> <title> mysql-verzenden </title> </head> <body> <?php $host="localhost"; $user="galienmasters"; $password=""; if(@$_GET['form'] == "yes") { echo "Database Selected: <b>{$_POST['database']}</b><br> Query: <b>$query</b><h3>Results</h3><hr>"; if($result == 0) "</b>"; elseif (@msql_num_rows($result) == 0) echo("<b>Query completed. No results returned.</b><br>"); else { <thead> <tr>"; "</th>"; } </thead> <tbody>"; { for($j = 0;$j<mysql_num_fields($result);$j++) { echo("td" . $row[$j] . "</td>"); } } </table>"; } <hr><br> <form action=\"{$_SERVER['PHP_SELF']}\" method=\"POST\"> <input type='hidden' name='query' value='$query'> <input type='hidden' name='database' value={$_POST['database']}> <input type='submit' name=\"queryButton\" value=\"New Query\"> <input type='submit' name=\"QueryButton\" value=\"Edit Query\"> </form>"; if (@$_POST['queryButton'] != "Edit Query") { $query = " "; } ?> <form action=" <?php echo $_SERVER['PHP_SELF'] ?>?form=yes method="post"> <table> <tr> <td align=right><b>Type in database name</b></td> <td><input type="text" name="database" value= <?php echo @$_POST['database'] ?> ></td> </tr> <tr> <td align="right" valign="top"> <b>Type in SQL - query</b></td> <td><textarea name="query" cols="60" rows="10"> <?php echo $query ?></textarea> </td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="submit Query"></td> </tr> </table> </form></body></html>
Even in code tags gezet want dit is maar raar werken.
Oohjah ps:
:rechts: Voorbeeld Codes zijn te downloaden op de website van Janet Valade, :links:
Als je ze niet direct vindt pm me even dan
Groeten, Wim |