I have a database created with some users in it on my website and would like to have a form on my website with a textbox that allows me to submit a full SQL query against my DB.
Is this possible when using PHP? I see it is possible in ASP.net but I am a bit unfamiliar with that language.
Example:
On my page, run_sql.php, I would like a textbox with a submit button.
In the textbox I would like to be able to run a command, such as
INSERT INTO `userdata`(`UserID`, `FirstName`, `LastName`, `Email`, `PF_Username`, `PF_Password`, `Endpoint`) VALUES ([value-1],[value-2],[value-3],[value-4],[value-5],[value-6],[value-7])
and have that write the declared values into my table.
sql.php code just for reference:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Run SQL - TEST</title>
</head>
<table border="0" cellpadding="10">
<tr>
<td>
<img src="images/api_rat.png">
</td>
<td>
<h1>TEST</h1>
</td>
</tr>
</table>
<body>
<form action="sql.php" method="GET">
<textarea name="comments" cols="25" rows="5">Enter your SQL query here...</textarea><br>
<input type="submit" value="Run Query on LIVE DB" />
</form>
</body>
</html>
Is this possible? Thanks in advance for your help! 🙂
sure, make a connect, and then do a mysql_query($_GET[‘comments’]);
But you know, that if this script is accessable from the net, you have a REALLY REALLY BIG PROBLEM? 🙂