Trying To Make A User Rating System

Started on the old forum in February 2009 · view the original in the archive · old links redirect here

26 replies · 1,399 views · started 17 years ago · 1 min read

4 participants
nclemale36 Lead · 537 posts #1

i have got so far . i have tried loads of variations of codes etc. cant get it to update correctly with the amount you click on . plus its only updating my own profile by 1 everytime i choose something. even if its a 9 it only goes up by 1.

it dont update other users at all .so as u see i need help lol . i done the hard work then get stuck. can anyone help . ta

this is in profile

echo "<form action=\"genproc.php?action=rate&sid=$sid\" method=\"post\"><p align=\"center\">";
  echo "<select name=\"rate\">";
  echo "<option value=\"1\">1</option>";
  echo "<option value=\"2\">2</option>";
  echo "<option value=\"3\">3</option>";
  echo "<option value=\"4\">4</option>";
  echo "<option value=\"5\">5</option>";
  echo "<option value=\"6\">6</option>";
  echo "<option value=\"7\">7</option>";
  echo "<option value=\"8\">8</option>";
  echo "<option value=\"9\">9</option>";
  echo "<option value=\"10\">10</option>";
  echo "</select>";
  echo "<input type=\"Submit\" Name=\"Rate\" Value=\"Rate\"></form>";

$nopl = mysql_fetch_array(mysql_query("SELECT rate FROM wap_users WHERE id='".$who."'"));

  echo "[b]Rating:[/b] $nopl[0]
";

this is genproc to update it

////////////////////
else if($action=="rate")
{
  $rate = $_POST["rate"];
  $bid = $_GET["bid"];
  addonline(getuid_sid($sid),"Rating a member","");
  //$uid = getuid_sid($sid);
  
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  $res = mysql_query("UPDATE wap_users SET rate='".$rate."' WHERE id='".$uid."'");
  if($res)
   {
        echo "<img src=\"../images/ok.gif\" alt=\"o\"/> rated successfully
";
   }else{
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!
";
  }
}else{
    echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You have rated this user before
";
 
  echo "

";
    echo "[b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></body>";
  

}

put me out my misery pmpl .

nclemale36 Lead · 537 posts #2

an update . worked out its not adding the ratings together . all its its doing is if i choose rate 4 it updates the database to 4. and if i again choose rate 2 it updates it to 2 . instead of adding the 4 and 2 together. am lost .anyone ??

subzero Super moderator Fellow · 3,954 posts #3
// Let's see how many is there count it up
$rate = mysql_fetch_array(mysql_query("SELECT COUNT(*) rate FROM wap_users  WHERE id='".$uid."' "));
// Let's add the rate + so the rate add's to the data
$id = $rate[0]+$rate;
// Ok.... done Lets send the query!!
$res = mysql_query("UPDATE wap_users SET rate='$id' WHERE id='".$uid."'");
// query has being sent to mysql Job done!

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

nclemale36 Lead · 537 posts #5

hate to say this but wer do i put the

$id = $rate[0]+$rate;

cos am getting an error i have never seen before

put it in index next to the form code and got error .

does this go in the update code in genproc if so wer abouts . ?? thank you so muchly lol

subzero Super moderator Fellow · 3,954 posts #6

I made misstake with id with id this will work

// Let's see how many is there count it up
$rate = mysql_fetch_array(mysql_query("SELECT COUNT(*) rate FROM wap_users  WHERE id='".$uid."' "));
// Let's add the rate + so the rate add's to the data
$go = $rate[0]+$rate;
// Ok.... done Lets send the query!!
$res = mysql_query("UPDATE wap_users SET rate='$go' WHERE id='".$uid."'");
// query has being sent to mysql Job done!

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #8
////////////////////
else if($action=="rate")
{
  $rate = $_POST["rate"];
  $bid = $_GET["bid"];
  addonline(getuid_sid($sid),"Rating a member","");
  //$uid = getuid_sid($sid);
  
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  // Let's see how many is there count it up
$rate = mysql_fetch_array(mysql_query("SELECT COUNT(*) rate FROM wap_users  WHERE id='".$uid."' "));
// Let's add the rate + so the rate add's to the data
$go = $rate[0]+$rate;
// Ok.... done Lets send the query!!
$res = mysql_query("UPDATE wap_users SET rate='$go' WHERE id='".$uid."'");
// query has being sent to mysql Job done!
  if($res)
   {
        echo "<img src=\"../images/ok.gif\" alt=\"o\"/> rated successfully
";
   }else{
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!
";
  }
}else{
    echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You have rated this user before
";

  echo "

";
    echo "[b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></body>";
  

}

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #9

id was mixing with id

so i change id to go

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

nclemale36 Lead · 537 posts #11

Fatal error: Unsupported operand types in /home/wap/public_html/web/genproc.php on line 2166

thats the same error i got when i put that one line in index too.

subzero Super moderator Fellow · 3,954 posts #12

Hmmm

found rate change to $ccrate

add $ccrate = "$rate";

replace $rate with $ccrate


rukiya Do You Mind kid read the dam forum will you any more smart mouth liar who cant fukin read wasting time kid!

This will be your warning!

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #13

Lets see it will count for you

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="../css/style.css"></link><title>PHP INFO</title>
</head><body>

<?php

if($act=="")
{

echo "<form action=\"?act=rate\" method=\"post\"><p align=\"center\">";
  echo "<select name=\"set\">";
  echo "<option value=\"1\">1</option>";
  echo "<option value=\"20\">20</option>";
  echo "<option value=\"30\">30</option>";
  echo "<option value=\"40\">40</option>";
  echo "<option value=\"50\">50</option>";
  echo "<option value=\"60\">60</option>";
  echo "<option value=\"70\">70</option>";
  echo "<option value=\"80\">80</option>";
  echo "<option value=\"90\">90</option>";
  echo "<option value=\"1008\">1008</option>";
  echo "</select>";

echo "<input type=\"submit\" value=\"SUBMIT\"/></form>";
}
else if($act=="rate")
{

$idc = "100";
$id = $idc+$set;

echo "$id";
}
?>
</body>
</html>

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #14

Hey try this http://sof.us.to/sig/setup/show.php

i made a CALCULATOR

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="../css/style.css"></link><title>PHP INFO</title>
</head><body>

<?php

if($act=="")
{

echo "<form action=\"?act=rate\" method=\"post\">";
echo "<input type =\"text\" class=\"bginput\" name=\"ad1\"/>
";
  echo "<select name=\"sa\">";
  echo "<option value=\"-\">-</option>";
  echo "<option value=\"+\">+</option>";
  echo "<option value=\"%\">%</option>";
 
  echo "</select>
";
echo "<input type =\"text\" class=\"bginput\" name=\"ad2\"/>
";
echo "<input type=\"submit\" value=\"SUBMIT\"/></form>";
}
else if($act=="rate")
{
if($sa =="+")
{
$id = $ad1 +  $ad2;
}
if($sa =="-")
{
$id = $ad1-$ad2;
}
if($sa =="%")
{
$id = $ad1%$ad2;
}

echo "$ad1 $sa $ad2 = $id";
}
?>
</body>
</html>

you can see what i did to make the CALCULATOR

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #15
////////////////////
else if($action=="rate")
{
  $rate = $_POST["rate"];
  $bid = $_GET["bid"];
  addonline(getuid_sid($sid),"Rating a member","");
  //$uid = getuid_sid($sid);
  
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  // Let's see how many is there count it up
$rate = mysql_fetch_array(mysql_query("SELECT COUNT(*) rate FROM wap_users  WHERE id='".$uid."' "));

// Let's add the rate + so the rate add's to the data
// replace rate with ccreate
$ccrate ="$rate";
$go = $rate[0]+$ccrate;
// Ok.... done Lets send the query!!
$res = mysql_query("UPDATE wap_users SET rate='$go' WHERE id='".$uid."'");
// query has being sent to mysql Job done!
  if($res)
   {
        echo "<img src=\"../images/ok.gif\" alt=\"o\"/> rated successfully
";
   }else{
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!
";
  }
}else{
    echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You have rated this user before
";

  echo "

";
    echo "[b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></body>";
  

}

Try this bro i leave the [0] in rate

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

looony Developer · 95 posts #16

this is the query for my updating off hits

$update = mysql_query("UPDATE sites SET hits= hits +1 WHERE namer='$ownr'")or die(mysql_error());

External image (may be gone)

if(isset($_SESSION['username'])) { print "everybody is a little loony inside"; } else { print"You should be shot"; }

crazybrumi Super moderator Principal · 1,064 posts #17

try this

////////////////////
else if($action=="rate")
{
  $rate= mysql_real_escape_string( $_REQUEST["rate"] );
  $bid = mysql_real_escape_string( $_REQUEST["bid"] );
  $who = mysql_real_escape_string( $_REQUEST["who"] );

   addonline(getuid_sid($sid),"Rating a member","");
  //$uid = getuid_sid($sid);
  
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
  echo "<p align=\"center\">";
  // Let's see how many is there count it up
$addplus = mysql_fetch_array(mysql_query("SELECT rate FROM wap_users WHERE id='".$who."'"));

// Let's add the rate + so the rate add's to the data
// replace rate with ccreate

$add = $rate;
$addplus = $add + $addplus[0];

// Ok.... done Lets send the query!!
$res = mysql_query("UPDATE wap_users SET rate= '".$addplus."' WHERE id='".$who."'");
// query has being sent to mysql Job done!
  if($res)
   {
        echo "<img src=\"../images/ok.gif\" alt=\"o\"/> rated successfully
";
   }else {
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You have rated this user before
";
   }

  echo "

";
    echo "[b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></body>";
  

}

dave inbox me on msn or sumat and al sort it out for ya.

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close