maths in php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    maths in php

    PHP Code:
    $addplus mysql_fetch_array(mysql_query("SELECT rate,total FROM gallery_files WHERE id='".$id."'"));

        
    $addplus $rate $addplus[0];
        
    $total $addplus[1] + 10;
        
    $res mysql_query("UPDATE gallery_files SET rate= '".$addplus."', total = '".$total."' WHERE id='".$id."'");
        if(
    $res){
        
    $main.="<p align=\"center\">";
        
    $main.="<img src=\"../phpThumb/phpThumb.php?src=../images/ok.gif\" alt=\"O\"/>You Have Rated This Picture Successfully<br/>";
        
    mysql_query("INSERT INTO rated SET id='".$id."', bywho='".getuid_sid($sid)."', value='".$rate."'"); 
        } 
    this dosnt want to add the 10 ontop of the saved scored in total. so every time some gets rated they get rated outa 10 so if 2 people rated them it would be rate/ out of 20 but the 20 wont updated to 30 when he next reate is done if u nw what i mean. :0 cheers folks.
    Want something coded email me at sales@webnwaphost.com for a prices.





    #2
    rate and total field are they int ?

    second you can do this by
    in single line query
    PHP Code:
    $update mysql_query("UPDATE `gallery_files` SET `rate` = `rate` + $rate ,`total` = `total` + 10  WHERE `id` = '" $logged['id'] . "';"); 

    Comment

    Working...
    X