Note that there are some explanatory texts on larger screens.

plurals
  1. POInfo not updated in database
    primarykey
    data
    text
    <p>once again it is me. I'll promise after this one I am done bothering you for a while!:)</p> <p>I have this rating system, which would allow user to rate an article. It is somewhat working, but the thing is that it doesn't update the data in the database and I have no idea why. Any help would be appreciated. :)</p> <pre><code>// Connects to your Database mysql_connect("URL", "username", "password") or die(mysql_error()); mysql_select_db("db_name") or die(mysql_error()); //Then we update the voting information by adding 1 to the total votes and adding their vote (1,2,3,etc) to the total rating if(isset($_submit['voted'])) { mysql_query ("UPDATE vote SET total= total+$voted, votes = votes+1 WHERE id = $id"); Echo "Your vote has been cast &lt;p&gt;"; } //Puts SQL Data into an array $data = mysql_query("SELECT * FROM vote") or die(mysql_error()); //Now we loop through all the data while($ratings = mysql_fetch_array( $data )) { //This outputs the sites name Echo "Name: " .$ratings['name']."&lt;br&gt;"; //This calculates the sites ranking and then outputs it - rounded to 1 decimal $current = $ratings['total'] / $ratings['votes']; Echo "Current Rating: " . round($current, 1) . "&lt;br&gt;"; //This creates 5 links to vote a 1, 2, 3, 4, or 5 rating for each particular item Echo "Rank Me: "; Echo "&lt;a href='index.php?site=kumu'?mode=vote&amp;voted=1&amp;id=".$ratings['id']."&gt;1&lt;/a&gt; | "; //The HREF was ".$_SERVER['PHP_SELF']." before Echo "&lt;a href='index.php?site=kumu'?mode=vote&amp;voted=2&amp;id=".$ratings['id']."&gt;2&lt;/a&gt; | "; Echo "&lt;a href='index.php?site=kumu'?mode=vote&amp;voted=3&amp;id=".$ratings['id']."&gt;3&lt;/a&gt; | "; Echo "&lt;a href='index.php?site=kumu'?mode=vote&amp;voted=4&amp;id=".$ratings['id']."&gt;4&lt;/a&gt; | "; Echo "&lt;a href='index.php?site=kumu'?mode=vote&amp;voted=5&amp;id=".$ratings['id']."&gt;5&lt;/a&gt;&lt;p&gt;"; } ?&gt; </code></pre> <p>Thanks guys!: )</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload