April 3, 201610 yr I'm hoping someone here can help me? I'm trying to create a simple web app for my own local use (i.e. not necessarily to publish to the web) that contains:- A table of data populated by a php query to a mysql database- Some bootstrap toggle buttons along the top that when pressed, filter the table contentsAt the moment I'm working on the assumption that I will use the toggle buttons to change the WHERE clause in the mysql query and then refresh the page automatically so that only relevant records are returned from the database. My problem is that I have absolutely no idea how to achieve this, to the point where my google searching isn't helping because I'm not sure what to look for.Can anyone point me in the right direction as to how I might approach this? Are there certain tools/languages that I should be looking for? I can make basic HTML pages and program in python so I have some technical skills, it's been many years since I looked at any web development though Any help would be appreciated!
April 4, 201610 yr Quick, easy way would be to use the buttons as links to this same page, with query parameters. The query parameters determine what query should be executed. So a bs button could be.. <a href="http://example.com/?query=xxx" class="btn btn-primary">Link 1</a> Then grab the value of $_GET['query'] and use some condition statements & logical operators to determine which query is executed. e.g if($query === 'xxx') : // query string here elseif($query === 'yyy') : // query string here endif; //execute query, output results Quickest way really, you could make it more elegant with the use of ajax if you want Edited April 4, 201610 yr by Samus
January 24, 20179 yr i think it may help you: http://bootsnipp.com/snippets/featured/easy-table-filter it can filter result as per your requirements. Hope it helps...
January 24, 20179 yr Quick, easy way would be to use the buttons as links to this same page, with query parameters. The query parameters determine what query should be executed. So a bs button could be.. <a href="http://example.com/?query=xxx" class="btn btn-primary">Link 1</a> Then grab the value of $_GET['query'] and use some condition statements & logical operators to determine which query is executed. e.g Quickest way really, you could make it more elegant with the use of ajax if you want The problem is, this is wide open to attacks, you're allowing direct access to your DB query through the URL. It would be easier to output the entries you need and filter them using Javascript.
January 24, 20179 yr The problem is, this is wide open to attacks, you're allowing direct access to your DB query through the URL. It would be easier to output the entries you need and filter them using Javascript. No it doesn't. Because you are passing a key which determines what query is executed, you aren't passing a query through the URL.
January 26, 20179 yr Wow, please read-up on web security and injection attacks.I think you still don't understand. What's the difference from setting up a parameter in your URL to execute a module in your code? I never said write queries in the URL, the OP was looking for how to output different content via button filters. If the queries are pre-written, explain how injection attacks come into this?
Create an account or sign in to comment