Forum Moderators: coopster
If anybody has any ideas, or knows how to do it please reply to this message or Mail me.
<form action="foobar.php" method="post">
<p>Enter Mysql query here</p>
<textarea name="query" rows="5" cols="60"></textarea>
<input type="submit" value="submit">
</form>
and then in your foobar.php:
<?php
....
$query=$_POST['query'];
mysql_query($query);
....
?>
is that what you're after, does it help at all?
Just a caveat on CTHouston's post. Don't let anybody else use a form like that our else you might not have a database anymore ;-) MySQL statements can be very powerful so you have to be careful who can execute them on your site.
If this is for users then you'll probably just want to pass some info, make sure it's good and then put it into an SQL statement. There lot's of good stuff in the library here to get you going. This one [webmasterworld.com] is a good start.
If you're looking for a way to administer your database with a web GUI you'll want to check out phpMyAdmin [phpmyadmin.net] or something similar.
Tim
UPDATE `members` SET `status` = 'banned' WHERE `name` = $change;
<form action="$change" method="post">
<p>Enter Mysql query here</p>
<textarea name="query" rows="5" cols="60"></textarea>
<input type="submit" value="submit">
</form>
<?php
// connect to database
$username = "username";
$password = "password";
$hostname = "host";
$database = mysql_connect($hostname, $username, $password)or die("Unable to connect to Database");
UPDATE `members` SET `status` = 'banned' WHERE `name` = $change;
?>
If anybody has any ideas please opst a reply here.
UPDATE `members` SET `status` = 'banned' WHERE `name` = $change;
should be enclosed in qoutes as string and should be assigned to some variable instead of just typing the line.
$sql="UPDATE `members` SET `status` = 'banned' WHERE `name` = $change";
mysql_query($sql) or die(mysql_error());
Regards
Kami