Jump to content

Getting Values From A Mysql Database


StaticHazard

Recommended Posts

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?

Link to comment
Share on other sites

 

 

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.