Limiting the number of data insertion in mysql database table [duplicate]
up vote
0
down vote
favorite
This question already has an answer here:
How to limit number of rows can be store in mysql table?
3 answers
I am making a localhost website (html, css, js, php and mysql). In that website there is a panel for Appointment. In the appointment section I have created a form asking for appointment date and appointment slot(morning, afternoon and evening).
Here I want to add a condition that for each date there can be at most 10 entries per slot., i.e., for ex: Date: 02-11-2018, morning slot-10 appointment, afternoon slot-10 appointment and evening slot-10 appointment.
Please help me as I am confused, whether I have to do some thing in my database table or in code section(simple html form) to achieve desired functionality.
I got a little bit similar post but the solution provided there didn't helped me. Solution available
In the solution there is two problem for me:
1- In my localhost/phpmyadmin ->db table -> trigger section, when I'm inserting same code it showing error.


2- In the solution link it is checking if the db table has 10 entries or not but in my case what i have to do is that on a particular date(which is selected from calendar) there can to 10 entries in each column (morning, afternoon and evening) and display list full when any of the column gets full and we try to insert into the same.
javascript php html mysql sql
marked as duplicate by Funk Forty Niner, Strawberry
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 11 at 0:17
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
0
down vote
favorite
This question already has an answer here:
How to limit number of rows can be store in mysql table?
3 answers
I am making a localhost website (html, css, js, php and mysql). In that website there is a panel for Appointment. In the appointment section I have created a form asking for appointment date and appointment slot(morning, afternoon and evening).
Here I want to add a condition that for each date there can be at most 10 entries per slot., i.e., for ex: Date: 02-11-2018, morning slot-10 appointment, afternoon slot-10 appointment and evening slot-10 appointment.
Please help me as I am confused, whether I have to do some thing in my database table or in code section(simple html form) to achieve desired functionality.
I got a little bit similar post but the solution provided there didn't helped me. Solution available
In the solution there is two problem for me:
1- In my localhost/phpmyadmin ->db table -> trigger section, when I'm inserting same code it showing error.


2- In the solution link it is checking if the db table has 10 entries or not but in my case what i have to do is that on a particular date(which is selected from calendar) there can to 10 entries in each column (morning, afternoon and evening) and display list full when any of the column gets full and we try to insert into the same.
javascript php html mysql sql
marked as duplicate by Funk Forty Niner, Strawberry
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 11 at 0:17
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
A fifth choice is to build the logic into the query itself
– Strawberry
Nov 10 at 23:31
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
How to limit number of rows can be store in mysql table?
3 answers
I am making a localhost website (html, css, js, php and mysql). In that website there is a panel for Appointment. In the appointment section I have created a form asking for appointment date and appointment slot(morning, afternoon and evening).
Here I want to add a condition that for each date there can be at most 10 entries per slot., i.e., for ex: Date: 02-11-2018, morning slot-10 appointment, afternoon slot-10 appointment and evening slot-10 appointment.
Please help me as I am confused, whether I have to do some thing in my database table or in code section(simple html form) to achieve desired functionality.
I got a little bit similar post but the solution provided there didn't helped me. Solution available
In the solution there is two problem for me:
1- In my localhost/phpmyadmin ->db table -> trigger section, when I'm inserting same code it showing error.


2- In the solution link it is checking if the db table has 10 entries or not but in my case what i have to do is that on a particular date(which is selected from calendar) there can to 10 entries in each column (morning, afternoon and evening) and display list full when any of the column gets full and we try to insert into the same.
javascript php html mysql sql
This question already has an answer here:
How to limit number of rows can be store in mysql table?
3 answers
I am making a localhost website (html, css, js, php and mysql). In that website there is a panel for Appointment. In the appointment section I have created a form asking for appointment date and appointment slot(morning, afternoon and evening).
Here I want to add a condition that for each date there can be at most 10 entries per slot., i.e., for ex: Date: 02-11-2018, morning slot-10 appointment, afternoon slot-10 appointment and evening slot-10 appointment.
Please help me as I am confused, whether I have to do some thing in my database table or in code section(simple html form) to achieve desired functionality.
I got a little bit similar post but the solution provided there didn't helped me. Solution available
In the solution there is two problem for me:
1- In my localhost/phpmyadmin ->db table -> trigger section, when I'm inserting same code it showing error.


2- In the solution link it is checking if the db table has 10 entries or not but in my case what i have to do is that on a particular date(which is selected from calendar) there can to 10 entries in each column (morning, afternoon and evening) and display list full when any of the column gets full and we try to insert into the same.
This question already has an answer here:
How to limit number of rows can be store in mysql table?
3 answers
javascript php html mysql sql
javascript php html mysql sql
edited Nov 11 at 5:09
asked Nov 10 at 23:02
Dhirendra Singh Bisht
116
116
marked as duplicate by Funk Forty Niner, Strawberry
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 11 at 0:17
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Funk Forty Niner, Strawberry
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 11 at 0:17
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
A fifth choice is to build the logic into the query itself
– Strawberry
Nov 10 at 23:31
add a comment |
A fifth choice is to build the logic into the query itself
– Strawberry
Nov 10 at 23:31
A fifth choice is to build the logic into the query itself
– Strawberry
Nov 10 at 23:31
A fifth choice is to build the logic into the query itself
– Strawberry
Nov 10 at 23:31
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Four choices come to mind. The first is to do all the checks in the application. Feasible, but not what you are asking.
The second is to write database triggers for insert and update. These would reject any additional appointments after the first 10.
The third would be to have 10 columns, one for each appointment slot.
A fourth choice would be to pre-populate a calendar table with the slots in separate rows. You would then update the slot that is needed.
I'm definitely not a fan of the third choice, but I include it to answer your question.
I would tend to go for the fourth or first option.
Someone please help.
– Dhirendra Singh Bisht
Nov 11 at 7:13
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Four choices come to mind. The first is to do all the checks in the application. Feasible, but not what you are asking.
The second is to write database triggers for insert and update. These would reject any additional appointments after the first 10.
The third would be to have 10 columns, one for each appointment slot.
A fourth choice would be to pre-populate a calendar table with the slots in separate rows. You would then update the slot that is needed.
I'm definitely not a fan of the third choice, but I include it to answer your question.
I would tend to go for the fourth or first option.
Someone please help.
– Dhirendra Singh Bisht
Nov 11 at 7:13
add a comment |
up vote
0
down vote
Four choices come to mind. The first is to do all the checks in the application. Feasible, but not what you are asking.
The second is to write database triggers for insert and update. These would reject any additional appointments after the first 10.
The third would be to have 10 columns, one for each appointment slot.
A fourth choice would be to pre-populate a calendar table with the slots in separate rows. You would then update the slot that is needed.
I'm definitely not a fan of the third choice, but I include it to answer your question.
I would tend to go for the fourth or first option.
Someone please help.
– Dhirendra Singh Bisht
Nov 11 at 7:13
add a comment |
up vote
0
down vote
up vote
0
down vote
Four choices come to mind. The first is to do all the checks in the application. Feasible, but not what you are asking.
The second is to write database triggers for insert and update. These would reject any additional appointments after the first 10.
The third would be to have 10 columns, one for each appointment slot.
A fourth choice would be to pre-populate a calendar table with the slots in separate rows. You would then update the slot that is needed.
I'm definitely not a fan of the third choice, but I include it to answer your question.
I would tend to go for the fourth or first option.
Four choices come to mind. The first is to do all the checks in the application. Feasible, but not what you are asking.
The second is to write database triggers for insert and update. These would reject any additional appointments after the first 10.
The third would be to have 10 columns, one for each appointment slot.
A fourth choice would be to pre-populate a calendar table with the slots in separate rows. You would then update the slot that is needed.
I'm definitely not a fan of the third choice, but I include it to answer your question.
I would tend to go for the fourth or first option.
answered Nov 10 at 23:12
Gordon Linoff
746k33285390
746k33285390
Someone please help.
– Dhirendra Singh Bisht
Nov 11 at 7:13
add a comment |
Someone please help.
– Dhirendra Singh Bisht
Nov 11 at 7:13
Someone please help.
– Dhirendra Singh Bisht
Nov 11 at 7:13
Someone please help.
– Dhirendra Singh Bisht
Nov 11 at 7:13
add a comment |
A fifth choice is to build the logic into the query itself
– Strawberry
Nov 10 at 23:31