In my application there is a filter option with checkboxes.Checkboxes indicates top five categories and all other categories under another single checkbox.That means total I have six checkboxes(top five + other).When all checked which will fetch all values from database table and when all unchecked which never fetch any values from table.Please anybody give any suggestions for my unchecked case...What will be the condition there?
In the unchecked case i wouldn't do a mysql query - cause it is not necessary and you can save that time. Depending on your application and your code you need to implement a switch here and insert the result on your page as if no result (or entry) has been found. For further details more application code is needed.
Related
I'm currently using MySQL Workbench to write very complex SQL Queries. To compare between different approaches, I need to know how many records have been returned by my query very quickly.
So, is there any way I can see the number of records returned by my query in the result grid as soon as I execute it?
I know that I can go to the 'Form Editor' tab and click on next and it will show me something like (2/179). But that's a very tedious process for me.
The "Action Output" pane (the bottom vertical pane) has a "Response" column that tells you how many rows were returned.
Philip Olson's way is a good one; yet another way is look at Query Stats in the same panel:
Rows sent to client is the one of interest; note Rows examined is not, as it shows how many rows the engine read to generate the results. (In this case, the operation was an inner join.)
I have a database table that looks like this, with some more information
Basically, I'm collecting results from e-Sports games in this table. Now, when I read the data, I'm putting them in tables to see how each team performs. Unfortunately, sometimes the team I have selected is team1, sometimes team2. Displaying this in a table really hurts the readability:
I'd like to have the team I have selected always on the left side. If I'd just switch team1 and team2 in the code, other information (like team1_roster or team1_percent) would be assigned to the wrong team. Is there any way to do this without using complex inconvenient methods?
Thanks in advance!
Do the "change/switch" in whatever code read the SQL and/or renders the table based on the selected condition.
This is no fundamentally different than choosing the column coloring, except it works on the row and not individual cell. This can be written 'generically' outside of the rendering as well; if reading each row as a "pair of data" (each team info is a datum) and then simply swap the pairs based on condition before containing processing.
This change is merely about the view (or model passed to the view generation) and it should not affect the underlying data or column names therein.
If just handled in SQL it would be a "complex inconvenient" query because it is about transposing N columns based on a condition, which is not something SQL likes to express.
Sorry if I am repeating the question, I have a HTML FORM page which displays the employee_id & attendance check box (IN, OUT) using datatable.
I made pagination with initial load value in the screen as 10, the data are loaded from mysql DB and all the data loads perfectly with pagination. I will update attendance status of each employee which checkbox and submit the form.
Once i submit the form, i called the PHP _POST (if(isset($_POST['save']))) , inside this i am trying to get the value of all employee_id & checkbox value but, i can able to get only first 10 rows, remaining in page 2,3,4,5 are not available, is there any option to get them, i tried with jquery for each too but it also alerts on first 10 rows.
Please help me out.
I need to post the data to database from data table regardless of pagination either using PHP post method (or) Jquery.
If you using pagination by LIMIT in database query there is, of course, no way you would get more than 10 rows, so, your <form> submit will not give you more than those 10 data arrays you can save to database.
Can you explain why you need to update all rows in database? Because limiting by pagination guarantees that other rows will not be affected (if query is right).
I m designing a website in which I want to add multiple rows into database on single click.
I want to add the results of the students of whole class in the students database which contains columns "s_id, subject_name, subject_result". I have design a simple form which list all the students and a text box in which result is to be added and on the submit button the results to be updated on the students database.
plzz give me some suggestions or link
There's a very good example on how to achieve this using PHP's implode statement right here in this very site. Mind you, I'm not sure what DB you're using but I'm going under the assumption that you're using a *AMP stack.
INSERT INTO results (`s_id`, `subject_name`, `subject_result`)
VALUES (1, 'a1', 's1'), (2, 'a2', 's2'), ...;
If they are submitting the information via a form then the variables should be in an array. You can just loop through the array inserting into the database upon each loop.
I know it's not multiple multiple rows being inserted at once, but it is very fast and works. I've used this method to insert thousands of records at a time with this.
Hope it helps.
Take care,
Shannon
Just to give you a bit of background i have a system where there's certain calculations that need to be calculated in the main section, there'll be various form fields under different tabs, for simplicity sake i have 10 sections, all with 20 drop down boxes and when you change the value of one of the drop downs it's recalculated in the main area (various calculations etc.) now these form values need to be persisted and stored in a database and then saved and reloaded when ever needed.
Logically i don't want the database to return 200records and then set the drop down boxes for them all manually (using maybe a switch statement) as that'll no doubt be a ball-ache.
Any suggestions?
Could you pull the records one or two select boxes ahead via ajax? Ie.
select1 <-- filled
select2 <-- filled
select3 <-- unfilled
select4 <-- unfilled
Once select1 is selected, make an ajax call that fills select 3.
If they are all in 10 sections, you could write queries that only return the 20 values or so you need. Or you could possibly break them into multiple tables, and use a couple relational tables to keep them straight. As far as the calculations, just store those in the database as well, and use ajax or the post submits to recalculate and update them when necessary.