Seite 1 von 7

SQL Error : 1064 | Rate-User Hack | funtions.php

Verfasst: 11.05.2006 16:06
von maxxo
Hallo,
habe einen USer Bewertungs hack eingebaut. Will man einem User �ber das UserProfil eine Bewertung abgeben und klickt auf den SubMit Button kommt folgender SQL Fehler:

-----------------
Could not insert rating informations

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

INSERT INTO phpbb_rate_users (rate_id,rated_id,rater_id,rate) VALUES (1,1126,9,)

Line : 1162
File : functions.php
---------------------

Zeile 1162 liegt innerhalb der FUnktion dees Hacks, die man bei der Installation in der functions.php einfach am Ende der Datei einf�gt. ( Zeile 1162 ist die rote)

------------------------------------------------


function rate_user($userdata, $profiledata, $rate)
{
global $db, $userdata, $profiledata, $phpEx, $phpbb_root_path;

$sql = "SELECT MAX(rate_id) AS total
FROM " . RATE_USERS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain next rate_id information', '', __LINE__, __FILE__, $sql);
}

if ( !($row = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_ERROR, 'Could not obtain next rate_id information', '', __LINE__, __FILE__, $sql);
}
$rate_id = $row['total'] + 1;

$sql = "INSERT INTO " . RATE_USERS_TABLE ." (rate_id,rated_id,rater_id,rate) VALUES (".$rate_id.",".$profiledata['user_id'].",".$userdata['user_id'].",$rate) ";
if ( !($result = $db->sql_query($sql)) )
{

message_die(GENERAL_ERROR, 'Could not insert rating informations', '', __LINE__, __FILE__, $sql);
}

$sql = "SELECT rate FROM " . RATE_USERS_TABLE ."
WHERE rated_id = ".$profiledata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert rating informations', '', __LINE__, __FILE__, $sql);
}
$raterow = $db->sql_fetchrowset($result);

$total_rate = 0;
for($i = 0; $i < count($raterow); $i++)
{
$total_rate = $total_rate + $raterow[$i]['rate'];
}

$new_average = round(( $total_rate / count($raterow))*100);

$sql = "UPDATE " . USERS_TABLE ."
SET user_average_rate = ".$new_average."
WHERE user_id = ".$profiledata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert rating informations', '', __LINE__, __FILE__, $sql);
}

$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=".$profiledata['user_id']."");
redirect($temp_url);
}
?>



------------------------------------------------


Kann sich des mal jemand ansehen ? :)

Besten Dank

Verfasst: 11.05.2006 19:31
von wwwthomasbauerattf
ich hab auch so an fehler (1064) beim bedankomat-mod...
kann da jemand weiterhelfen

Verfasst: 11.05.2006 20:18
von maxxo
genau dieselbe?

Verfasst: 11.05.2006 21:34
von wwwthomasbauerattf
bei mir funktionierts jetzt:

1. Hast du wirklich alle geänderten Datei hochgeladen und auch alle Neuen
2. Hat die Installation bei dir geklappt

Verfasst: 28.05.2006 01:39
von maxxo
sorry, des ich mich erst jetzt melde:

ja, habe alles hochgeladen.
Alle veränderungen werden ja auch angezeiegt, also sind online, nur wenn ich auf den Absenden Button klicke um zu Berwerten kommt das.

Verfasst: 28.05.2006 11:40
von maxxo
kann mir vllt. heute jemand helfen? :)

Verfasst: 28.05.2006 16:51
von maxxo
kennt keiner dieses Problem?

Verfasst: 28.05.2006 22:04
von maxxo
Es muss such doch jemand auskennen ;)

Verfasst: 29.05.2006 09:55
von maxxo
heute vielleicht? :)

Verfasst: 29.05.2006 15:49
von maxxo
bitte :)