Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to create a Feedback form for my website with rating system, which will then display the monthly average rating to a separate page as a graph.
I do have a little concept. But It's lacking something. I know how to create a feedback form. But I am confused on how to save it in Mysql. I mean do I need to calculate the average rating before saving it to mysql or when calling from the graphs page.
Please help me with concept or example.
Thanks.
You will have a form, where the user will put all the rating and the info.
When the user press the "Send" button you will execute a PHP code, this script will take the value of the form, and insert them inside a database, with the current year / month.
When you will go on the page that will show the rating you will execute a php code that will take all the rating in the current year/month from the database , sum them, and do the average calculation. Then you will show the value.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to be able to have my main page (index.php) check every 10 seconds for a change in the mysql database table 'refresh'. If the 'refresh' value is 1 it needs to refresh the page in its entirety. If the value is zero it does nothing. I would use meta-refresh but I cannot have the page always refreshing as the page has a slider and it would mess up the rotation. Please let me know what you think of! Thanks in advance!
Use AJAX to check if an update is required.
http://api.jquery.com/jQuery.ajax/
You should learn the basic how to's of AJAX before using something like jQuery when you don't even know what's going on.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
In my website users can post submissions, and I want other users to be able to do what would be my equivalent of facebook's "likes".
But I don't know how to implement this. My main problem is that I need to prevent uses from liking the same thing more than once.
I was planning to add a long string into the database entry of each submission, for example "userid:rating/userid:rating/userid:rating". But I think that would be highly inefficient, because I would need to parse the string every time someone presses a button, and if there's lots of ratings then it would have to do a lot of work I think.
Should I make a separate table for ratings globally, and use the submission ID to link them to the right thing, or what? I feel it would be very inefficient to make mysql dig through the whole database and look for all individual rating entries that have a matching ID every time someone opens a submission page...
You create another table: submission_rating. Three columns would suffice: rating, submission_id and user_id.
Someone presses like, you do an an INSERT. But, before you do the insert, you check whether or not this particular user has already liked this submission. If the user has, you remove the like. If it does not, you insert the rating.
edit: As two gentleman below suggested, rather than relying on another check, go for the UNIQUE index. Make sure you catch the error and properly show it when trying to insert. Boldly said, if(!$insert) {}.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to create something like this:
I've been able to create it statically, just type int everything fixed in the code. I want to have it done dynamically, I've built the database which consists of all the data I need to have in this table.
But what I can't figure out how to achieve is the first two rows (Day and Date). Other than that, I can fill all from the data base (Group Members and data associated with.
Can someone direct me on how to achieve first two rows? or should I also set them with the data in the database?
EDIT
I need at least how to convert the day (1-Nov) to day. I will use current year (2013) or next year (2014) for now.
You may usefull following links. you can start from here and then can analyse there codes.
link 1 link 2
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to create a simple PHP web system to “view”, “add”, “edit” and “delete” loan applications. The problem is during add new loan records to the system because i need to calculate formula for calculating "home loan" installment amount
The formula :
amount and duration is fetch during user fill up the form
Question : How i do mathematical operation to calculate installment amount from what user fill in the form to insert in mysql database? Thanks
Hope this helps.
<?php
$interest=0.5;
$amt=$_POST['amount'];
$duration=$_POST['duration']; // duration is in months
$intamt=pow((1+$interest),$duration);
$intamt2=pow((1+$interest),($duration-1));
$installment=($amt*0.5*$intamt)/$intamt2;
echo $installment;
?>
Check the working example here(http://codepad.org/Fw3wbsUP)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have got two php forms - question.php and marks.php. I want that each time question.php submits its values to marks.php , the variable $total in the form marks.php be incremented. I have tried using static variable but still am not able to get it done!
Nothing "inside PHP" itself will persist anything across different page loads. You need to store the value somewhere "external", e.g.:
write it to a file
write it to a database
store it in a memcache or other kind of cache
send it to yourself in an email
burn it into the screen of the computer and use an elaborate video camera and OCR setup to read it back
...
maybe: sessions