
|
Hi I have a SQL Server Table named News with the following
columns-id,Title,Body,Created datetime and
Inside It's a column 'Number of clicks'.
Now I want to increment it by 1 when the title of a particular news is clicked.I need the c# code.Help, i can't do it
|
|
|
|

|
Don't post the same question in multiple forums.
Also, this question has nothing to do with javascript.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|

|
Ive tried to do something with the click thing. that u could only reserve from the seatmap depends of quantity of tickets u bought. I dont have whenever i click a seat it always get the original value that it fetched from the line 3.
<script>
$(document).ready(function(){
var qty = $("#qty").val();
var hasBeenClicked = false;
jQuery('.a-seats').click(function(){
qty--;
});
if(qty == 0){
document.getElementById("a-seats").style.zIndex='-1';
}
});
</script>
|
|
|
|

|
Move this : var qty = $("#qty").val();
to
jQuery('.a-seats').click(function(){
qty = $("#qty").val();
qty--;
});
|
|
|
|

|
Hello ive tried it but it also doesnt work.
here is the new code
<script>
$(document).ready(function(){
jQuery('.a-seats').click(function(){
qty = $("#qty").val();
qty--;
});
if(qty == 0){
document.getElementById("a-seats").style.zIndex='-1';
}
});
</script>
|
|
|
|

|
What did not work, be more specific. Did you include jquery library in the header? Do you have an element with class='a-seats'? Can you show the other code?
|
|
|
|

|
I used ajax for this query and for the seatmap and had a header onto the seatmap main file, the code below are the few code which is like a function that will be printed out in a div in seatmap main file.
<script>
$(document).ready(function(){
jQuery('.a-seats').click(function(){
qty = $("#qty").val();
qty--;
});
if(qty == 0){
document.getElementById("a-seats").style.zIndex='-1';
}
});
</script>
<?php
$db = mysqli_connect('localhost','root','','capstone');
$getallmsg = "SELECT * FROM reservation where seatColumn = 'A' ORDER BY Id DESC"; //ORDER BY seatId DESC
$result = $db->query($getallmsg);
echo '<div id="a-holder">';
while ($holder = $result->fetch_array(MYSQLI_ASSOC)) {
$template = '<div class="a-seats" id="%s"></div>';
$id= $holder['seatId'];
$reserved = $holder['reserved'];
printf("$template ",$id);
?>
<?php
}
echo '</div>';
/*free result set */
$result->free();
/* close connection */
$db->close();
?>
|
|
|
|

|
As far as I can see:
1. There is no inclusion of jquery library;
2. There is no element with id='qty'.
Suggest you take a look some jQuery examples: jquery_selectors[^]
|
|
|
|

|
but i have inclusion from its parent.
ohh ive deleted it
<?php
$qty = $_POST['qty'];
echo '<input type="hidden" id="qty" value="'.$qty.'">';
?>
<script>
$(document).ready(function(){
qty = $("#qty").val();
jQuery('.a-seats').click(function(){
if(qty != 0){
alert(qty);
qty--;
}else if(qty == 0){
document.getElementByClass("a-seats").style.zIndex='-1';
}
})
});
</script>
nothing changed..
|
|
|
|

|
hello, as u can see i put an alert(qty); but whenever i clicked the button it popped out the same value of qty and will not decrement nor increment.
|
|
|
|