Altering Mootools Rating System To Update Database?
Nov 9, 2009
im trying to add a star rating system to a website. id like to do something elegant graphically instead of just using a drop down... the javascript framework im using is mootools and i found a great rating system here, but have no idea how to adjust it so that it updates the database with the new rating vote from the user and it calculates the new average rating.
the way i have the database set up for this is with the following fields: id (the rating's unique id) listingid (the listing that the rating corresponds to) userid (the user that entered the rating) rating (the rating itself)
i use php to communicate with a mysql database. the file im going to write will check to see if there is already a rating entered in from the logged in user. if there is, it will update it. if not, it will insert it, then it will calculate the average of all votes for that listing (rounded up) and return the new rating to the page and set the stars to reflect that rating... ive tweaked the code a bit to represent a 5 star system instead of a 10 star system and also so it can be used multiple times on a page.
heres what ive been playing with:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
[Code].....
View 6 Replies
ADVERTISEMENT
Dec 13, 2005
I was wondering if anybody had code for a rating system, like on alot of game sites it has stars and I was wondering how to do that,
View 2 Replies
View Related
Jul 28, 2009
can someone tell me how to create a simple rating system with stars or something like that and can i do it in js?
View 1 Replies
View Related
Apr 3, 2009
I am a webmaster trying to implement an auto-content update system without using PHP, which is challenging for me because I use PHP, JAVA, C(and extentions), HTML usually. My current project requires me to not use PHP so I am using javascript and xml.
I have the code written out but I am running into an error with Safari 4.
Here's my code:
<script type="text/javascript">
var req;
function loadXMLDoc(url) {
var xmlDoc=null;
[Code].....
View 9 Replies
View Related
Aug 3, 2010
I have a table in a database that gets populated by a client application. Whenever an entry is written to the table I want to fetch the data (which contains the longitude and latitude) and display a marker on Google Maps. I am using the Google Maps Javascript V3 API. Reading the tuples from the database is currently done through a PHP script. How can I update the map each time a tuple is written to the database?
View 1 Replies
View Related
Nov 12, 2010
I am working on a chat program. When a user logs in, a value in the database is set to 1 (online), and when he/she logs out it is set to 0 (offline). The problem is, when the user exits the browser, naturally the value is still set to 1.
I was wondering if it is possible using AJAX or otherwise to update the database on the event of browser close? I have tried onbodyunload in the body tags pointing to a file with a JavaScript function containing the PHP code (query to update the field) but cant get it to work.
View 7 Replies
View Related
Mar 16, 2011
I'm trying to update a sql table from mi php Ajax web page, which stores dynamically a table into the page by table.appendChild(row) , so that the user can verify the information he is inserting before the actual database update.
How do I do this with ajax?
View 2 Replies
View Related
Oct 4, 2011
we are developing an web application. In this user has an option to comment or mark a video. After user commented or marked it has to shown automatically on the page with out refreshing the page.
View 1 Replies
View Related
Mar 18, 2010
I am a newbie in web development. I need to create a function that works whenever user print a web page, I would like to get the date and record that date into database. Additionally, the function must work on IE & Firefox. There is onbeforeprint() event in JavaScript, but that only works in IE.
View 2 Replies
View Related
May 13, 2010
I have a been developing an Online auction website using PHP and Mysql for the last few weeks. I have implemented everything including the 'bidding', 'buy it now' options of the auction etc.
I don't know much about AJAX to be honest, but I think it is the technology I need for this... My requirement is to devise a way of updating (in real-time) the current price of a particular auction product as more and more users bid on the item. Once a user bids on the item, the bid table of the database is updated with the highest bidders price. So once this value changes in the database, would it be possible to update the price on the webpage? Obviously, it is important for this update to be as accurate as possible to maintain the integrity of the auction.
View 8 Replies
View Related
Oct 8, 2010
I was wondering if someone could help me out with the following.I'm developing a webshop CMS in which you can create categories. By using jquery's ajax method I'm making a POST request to a PHP script which then handles all the data supplied to it. This works good and all except for the fact that after the query is being executed my HTML doesn't get updated, at least not as well as I want it to.I understand that the common way of working here is to update HTML in the success callback of the ajax method. But the thing is that every category is being displayed as a list item with an id attribute, this id corresponds to the id the category has in the database.If$.ajax tells me that everything went down smoothly and my query has been executed then there's still no way for me to know which id this new category has been given so that I can update the HTML accordingly.
What would be a "smart" way to tackle this? The first thing that comes to my mind is simply calling another script which figures out the last inserted id on the db but that would mean doing an ajax request in the callback of another ajax request? That doesn't sound right to me..
View 9 Replies
View Related
Mar 15, 2009
I am a graphic designer who has been stuck with creating a voting system for my son's school newspaper website.
Here is what I have so far: [url]
You will see that it is a 1-10 voting system where the user drags the choices into the order of his preference then hits submit. It is working on on a functional level, but I have no idea how to make it work on the backend. I need to somehow accomplish the following:
1. Either get rid of the numbers on the left or somehow stop them from all becoming "1" when dragged.
2. Upon hitting "submit" the votes should be added to a database. I can create a database but I have no idea how to get these numbers into it.
3. The 10 choices will change each week for at least 13 weeks so the database needs to adapt to this.
Here is a zip file with all of the files used on the voting page: [url]
View 2 Replies
View Related
May 4, 2011
I have a problem, I am by no means new to PHP/Javascript but am finding an error that I cannot ridicule how to stop.Ok Ill try and explain it in simple terms:I have two divs, div1 and div2,In div1 there are links whitch are fetched from the databaseIn div2, content from links href ? in div1 is collected through AJAX.No I have a php preg_replace function that replaces it to look like <a href='#' onclick=\"showTopic(0,$char,'$1');\">$1</a> Now when you click this, it inserts into the "tpm" table in the database,(this table holds the links for div1) But it will not update the links unless i refresh the page? I would like to knoe how to update the links in div1 without refreshing, because refreshing = going back to the start of the code i am working on.
View 3 Replies
View Related
Jul 12, 2011
This jquery code pulls in an XML file, then passes the contents down to the nested POST call to add all of the records from the XML into a database table (which is handled by the saveSenatorRecord.asp file). This all works fine.. except that when the POST is called for "EACH" of the member nodes I expected the success: function to be called once after each of the records are added to the table. But what appears to be happening is that when function is called in the EACH property... it adds all of the records to the database table at one time, THEN it calls the success function once for each individual record.. but AFTER they have all been added.
View 1 Replies
View Related
Jul 23, 2005
I am trying to create a web page in which the contents of one selection list
depends upon which element in another selection list is chosen, but where
the information to populate the first selection list comves from an SQL
database on the web server.
There are a couple of these situations in my application but, for example,
the first list might be a list of counties, and the second list a list of
states/provinces. Obviously the names of counties depend upon which
state/province is chosen, but there are too many possibilities to be able to
embed them within the web page itself. So when the user selects a
state/province I need to go to the server to ask for the list of counties.
I have seen a number of posts that sort of address this issue. For example
it is suggested to use <script src="a URL"/> to ask the server side code to
send up data of type "text/javascript". However the examples do not seem to
address how the server side code would know which state/province the user
had selected.
If there is a web site that addresses this sort of thing, I would appreciate
any pointers.
View 5 Replies
View Related
Dec 29, 2011
i want to add a part of the website that will be generated from mysql database from an external file just like php include just that i want these parts to update realtime without refreshing the browser. i also want it to have pagination.
View 6 Replies
View Related
Jul 15, 2011
I am having trouble accessing both the Class and the current element. How can I have access to both the current element and the Class?
// Class stuff above
fuction1 : function () {
myelements.addEvent('click', this.function2);
[code]....
View 6 Replies
View Related
Mar 30, 2006
Does ne one have a Rating script same as on google groups...
the one wid stars..n the rating gets saved too...in some variable..
View 7 Replies
View Related
Jul 23, 2005
Is it possible in jscript to have a
Rating 1 to 3 in order of preference.
That means if a user rates by inputing a value 3 for example in a texbox
or selecting 3 using dropdown menu.
The next available options should be 2 and if he/She inputs 2 the next
available option should be 1. Code:
View 4 Replies
View Related
May 18, 2009
I would like to create a thumbs up/down or yes/no like rating using jquery and php/mysql. I want to show two images and then when clicked, would like to display "thanks" and then store the value along with the page id(from the url) in the mysql db. Rating can be allowed only once for that id from one ip. I am assuming i can set a cookie or store the ip address and validate if that ip and the page id is already there.
View 4 Replies
View Related
Apr 11, 2007
function func1() {
this.val = 1
}
function func2() {
this.getVal = function() {return this.val}
}
var inst1 = new func1();
var inst2 = new func2();
inst2.getVal(); //should return 1
So the point is how can i change the object that this refers to?
View 4 Replies
View Related
Jun 14, 2009
I can't seem to figure out how to set the star rating value at clientrun time
View 1 Replies
View Related
Jul 22, 2009
Code:
<td>
<ul class="rating nostar" id="Torpedo">
<li class="one"><a href="javascript:RateItem('Torpedo', 1);" title="1 Star">1</a></li>
<li class="two"><a href="javascript:RateItem('Torpedo', 2);" title="2 Stars">2</a></li>
<li class="three"><a href="javascript:RateItem('Torpedo', 3);" title="3 Stars">3</a></li>
<li class="four"><a href="javascript:RateItem('Torpedo', 4);" title="4 Stars">4</a></li>
<li class="five"><a href="javascript:RateItem('Torpedo', 5);" title="5 Stars">5</a></li>
</ul>
</td>
This is a rating star row which is suppose to refresh without a browser refreshing. It is refreshing but is not CSS formatting to
Code:
<td><strong>Raiting:</strong></td>
<td>
<ul class="rated twostar" id="Torpedo">
<li class="one">1</li>
<li class="two">2</li>
<li class="three">3</li>
<li class="four">4</li>
<li class="five">5</li>
</ul>
I have to refresh the browser in order to
Code:
<td><strong>Raiting:</strong></td>
<td>
<ul class="rated twostar" id="Torpedo">
<li class="one">1</li>
<li class="two">2</li>
<li class="three">3</li>
<li class="four">4</li>
<li class="five">5</li>
</ul>
to appear..
It's the javascript working? This is the code before clicking on one of the star in the star row.
Code:
<style type="text/css">
<!--
.style1 {color: #FF3300}
.style2 {color: #FFFFFF}
.style3 {color: #000000}
-->
</style> .....
The javascript links that should do the refreshing automatically supposed to be the two below:
Code:
<script type="text/javascript" src="scripts/prototype.js"></script>
<script type="text/javascript" src="scripts/rating.js"></script>
How can it be possible to auto refresh it?
View 2 Replies
View Related
Jul 24, 2009
how to implement this bit of UI wizardry. I have a list of categories and the user is asked to pick all applicable items and then rate them individually. Right now I have a long list with checkboxes. Whenever a user checks one of the boxes a rating control pops up next to it and they just select the number of stars they want to rate the item.
Although this works for my purposes, it's a bit clumsy and takes up a lot of real estate (I have 30 items in the list so far and this may grow). What would be the best way to get this done?
View 1 Replies
View Related
Dec 8, 2010
first off I am pretty much a newbie to web development but especially to java script so go easy with the tecnical terms I am trying to implement an image carousel but I cant get it to work and it is altering the width of my div in the HTML. I have the slider in div id="content", when I dont have the JS file in the folder the div shows up fine but when I have the JS file in the right place it resizes it to 1024*50 so none of the content can be seen. I was wondering if anyone could make sense of the JS file and see if anything would be causing that? I must also point out that I havent written this code, I have copied it from the web.
View 1 Replies
View Related
Apr 21, 2004
Is it possible to alter the contents of a remote page in an iframe through javascript? I have a page I'm showing from a remote server that has no style at all.. and I can't stand the Times New Roman font on my page.
View 4 Replies
View Related