StaticHazard Posted December 3, 2012 Share Posted December 3, 2012 I have a PHP/HTML file that connects to my MySQL database. The HTML part just makes the text area, but the PHP part does all the work. When a user enters a SQL command, it sends it to the database, and returns the value on the screen, just below the text area. It works great for checking and viewing data, such as SELECT * FROM blah and DESCRIBE blah, etc. However, if the user wants to query the database, I have problems returning the result. Any SQL keywords such as WHERE, AND, GROUP BY, HAVING, ORDER BY, etc don't return anything. I can see that the query was successful because I have a PHP line that counts the rows affected, so I always see how many rows should be returned, but the data doesn't show up. I think it would be a bit tedious to code in PHP what to do for every single possible SQL keyword. Is there some way I can just grab the returned table and put it on the screen? Quote Link to comment https://forums.phpfreaks.com/topic/271558-getting-values-from-a-mysql-database/ Share on other sites More sharing options...
MDCode Posted December 3, 2012 Share Posted December 3, 2012 You are letting users query your database? Aren't you a bit concerned that there are security issues? As for your problem I can not understand one bit of your description. Quote Link to comment https://forums.phpfreaks.com/topic/271558-getting-values-from-a-mysql-database/#findComment-1397320 Share on other sites More sharing options...
Muddy_Funster Posted December 4, 2012 Share Posted December 4, 2012 Only SELECT style queries will return a table, there is no table returned when you execute INSERT or UPDATE. As SELECT is an SQL Keyword, as you call them, I don't follow what you are saying about them not working. Perhaps your code and some examples of when it goes wrong would be of assistance? don't you think? Quote Link to comment https://forums.phpfreaks.com/topic/271558-getting-values-from-a-mysql-database/#findComment-1397422 Share on other sites More sharing options...
gizmola Posted December 5, 2012 Share Posted December 5, 2012 I have a PHP/HTML file that connects to my MySQL database. The HTML part just makes the text area, but the PHP part does all the work. When a user enters a SQL command, it sends it to the database, and returns the value on the screen, just below the text area. It works great for checking and viewing data, such as SELECT * FROM blah and DESCRIBE blah, etc. However, if the user wants to query the database, I have problems returning the result. Any SQL keywords such as WHERE, AND, GROUP BY, HAVING, ORDER BY, etc don't return anything. I can see that the query was successful because I have a PHP line that counts the rows affected, so I always see how many rows should be returned, but the data doesn't show up. I think it would be a bit tedious to code in PHP what to do for every single possible SQL keyword. Is there some way I can just grab the returned table and put it on the screen? Is there a reason beyond the academic that you are reinventing phpMyAdmin, Adminer and several other similar tools? As MuddyFunster stated, you only get results on SELECTS. There are also seperate api calls to show you information on rows affected by insert/update/delete queries, but aside from that it sounds like you want the equivalent of a tabular interface, and that's already been done quite well in other existing tools. Quote Link to comment https://forums.phpfreaks.com/topic/271558-getting-values-from-a-mysql-database/#findComment-1397636 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.