mjwallink
%Europe/Berlin %552 %2008, 14:16
Hallo,
Ik ben bezig een video player te maken wat ook is gelukt. Maar nu wil ik er een rating functie inbouwen. en op de een of andere manier is er of in de as iets fout, of in het php bestand.
as:
myVars = new LoadVars();
myVars.onLoad = function(success){
if(success){
ratingUpdate = rating;
}
}
this.rating_mc.btn5.onRollOver = function(){
this.onPress = function(){
myVars.video_id = _root.videoId;
myVars.rating = 5;
myVars.sendAndLoad("updaterating.php", myVars, "GET");
}
rating_mc.ratingMask_mc._width = 163;
this.onRollOut = function(){
rating_mc.ratingMask_mc._width = 1;
}
}
php
<?PHP
include('includes/configure.php');
mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die(mysql_error());
mysql_select_db(DB_DATABASE);
mysql_query("INSERT INTO tbl_ratings ( page, rating_value ) values ( '".$_GET['video_id']."', '".$_GET['rating']."' )") or die(mysql_error());
//$fp = fopen('log.txt', 'w+');
//fwrite($fp, $_GET['rating']." - ".$_GET['video_id']);
//fclose($fp);
//print_r($_GET);
$result = mysql_query("SELECT AVG(rating_value) as rating FROM tbl_ratings WHERE page = '".$_GET['video_id']."'");
$row = mysql_fetch_array($result);
echo "&rating2=\"".$row['rating']."\"&videoId=\"".$_GET['video_id']."\"";
?>
iemand een idee?
Alvast bedankt
Ik ben bezig een video player te maken wat ook is gelukt. Maar nu wil ik er een rating functie inbouwen. en op de een of andere manier is er of in de as iets fout, of in het php bestand.
as:
myVars = new LoadVars();
myVars.onLoad = function(success){
if(success){
ratingUpdate = rating;
}
}
this.rating_mc.btn5.onRollOver = function(){
this.onPress = function(){
myVars.video_id = _root.videoId;
myVars.rating = 5;
myVars.sendAndLoad("updaterating.php", myVars, "GET");
}
rating_mc.ratingMask_mc._width = 163;
this.onRollOut = function(){
rating_mc.ratingMask_mc._width = 1;
}
}
php
<?PHP
include('includes/configure.php');
mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die(mysql_error());
mysql_select_db(DB_DATABASE);
mysql_query("INSERT INTO tbl_ratings ( page, rating_value ) values ( '".$_GET['video_id']."', '".$_GET['rating']."' )") or die(mysql_error());
//$fp = fopen('log.txt', 'w+');
//fwrite($fp, $_GET['rating']." - ".$_GET['video_id']);
//fclose($fp);
//print_r($_GET);
$result = mysql_query("SELECT AVG(rating_value) as rating FROM tbl_ratings WHERE page = '".$_GET['video_id']."'");
$row = mysql_fetch_array($result);
echo "&rating2=\"".$row['rating']."\"&videoId=\"".$_GET['video_id']."\"";
?>
iemand een idee?
Alvast bedankt