elflacodepr Posted July 23, 2008 Share Posted July 23, 2008 hello all, I designing my MySQL query system, for now I can do all commands(insert, delete..etc.), the next step add a script where it displays the results, for example if I type: SELECT * FROM tbl, it must display the results in a table. any help? Heres the script <?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<br/><b>Query:</b><pre>' . $querybox . '</pre><b>Error: </b>' . mysql_error()); echo "Query entered!"; include 'library/closedb.php'; } ?> Link to comment https://forums.phpfreaks.com/topic/116264-query-system/ Share on other sites More sharing options...
DarkWater Posted July 23, 2008 Share Posted July 23, 2008 Why re-invent the wheel when you can just use something like phpMyAdmin? Link to comment https://forums.phpfreaks.com/topic/116264-query-system/#findComment-597818 Share on other sites More sharing options...
elflacodepr Posted July 23, 2008 Author Share Posted July 23, 2008 phpMyAdmin is the inspiration plus I'm doing this for project of myself Link to comment https://forums.phpfreaks.com/topic/116264-query-system/#findComment-597820 Share on other sites More sharing options...
DarkWater Posted July 23, 2008 Share Posted July 23, 2008 So you're basically trying to reinvent the wheel. You'd probably need to run a DESCRIBE table; and extract the column names. Link to comment https://forums.phpfreaks.com/topic/116264-query-system/#findComment-597821 Share on other sites More sharing options...
elflacodepr Posted July 23, 2008 Author Share Posted July 23, 2008 ya got me lost there ??? Link to comment https://forums.phpfreaks.com/topic/116264-query-system/#findComment-597828 Share on other sites More sharing options...
DarkWater Posted July 23, 2008 Share Posted July 23, 2008 Open up the mysql client and run this query: DESCRIBE some_table\G (The \G just makes it easier to read and see what's actually returned for you to loop through; don't use it in PHP.) You can see that it returns the column names, types, etc. Link to comment https://forums.phpfreaks.com/topic/116264-query-system/#findComment-597832 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.