elflacodepr Posted July 5, 2008 Share Posted July 5, 2008 Hello...I want to know if this is possible, every time i try it says that query failed...any help? <?php if(isset($_POST['save'])) { include 'library/config.php'; include 'library/opendb.php'; $querybox = $_POST['query_content']; //Query $sql = mysql_query("$querybox") or die('Error, query failed'); echo "Query entered!"; include 'library/closedb.php'; } ?> <html> <body> <form method="post"> <table width="700" border="0" cellpadding="2" cellspacing="1" align="center"> <td width="100">Query Content:</td> <td><textarea name="query_content" cols="50" rows="10"></textarea></td> </tr> <td colspan="2" align="center"><input name="save" type="submit" value="GO!"></td> </tr> </table> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/113372-query-box/ Share on other sites More sharing options...
wildteen88 Posted July 5, 2008 Share Posted July 5, 2008 Yes what you're doing is possible, aslong as you're entering a valid MySQL query in the textarea. To see why your query is failing chnage: $sql = mysql_query("$querybox") or die('Error, query failed'); to $sql = mysql_query($querybox) or die('Error, query failed<br ><b>Query:</b><pre>' . $querybox . '</pre><b>Error: </b>' . mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/113372-query-box/#findComment-582459 Share on other sites More sharing options...
elflacodepr Posted July 5, 2008 Author Share Posted July 5, 2008 Thanks, it worked! Quote Link to comment https://forums.phpfreaks.com/topic/113372-query-box/#findComment-582461 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.