PDA

View Full Version : I'm desperate now...



SetroGamer
September 22nd, 2003, 08:30 PM
I want to make a send score with PHP for my flash game. But I am completely confused on how to do this. I just don't get it. I got it to load the PHP page and used the POST method with it. And I got it to set this on the PHP page, after the db connection:

$score=$_POST['score'];
And then I have where it sends your score and updates how much money you have for playing. BUT it doesn't know what your score was. Oh, yeah, I'm currently using this method with action script:

onClipEvent (load) {
loadVariables("http://setropets.com/worlds/GamiaIsland/gspong.php", _blank, "POST");
}

I've tried so many different ways to do this and none of them have worked that its insane. I'm really getting desperate. Can someone please help me??

Jubba
September 22nd, 2003, 11:15 PM
try


onClipEvent (load) {
loadVariablesNum("http://setropets.com/worlds/GamiaIsland/gspong.php", 0, "POST");
}

SetroGamer
September 22nd, 2003, 11:42 PM
still doesn't work :( here's the flash file attached...
And here's what's on the php page:

<?php
//my db connection is here

?>

<?php
$score=$_POST['score'];
$date=date(Ymd);
mysql_query("UPDATE users SET sc=sc+$score WHERE username='$username'") or die(mysql_error());
mysql_query("INSERT INTO scores VALUES('pong','$username','$score','$date')") or die(mysql_error());
?>

Jubba
September 22nd, 2003, 11:50 PM
<?php
//my db connection is here

?>

<?php
$score=$_POST['score'];
$date=date(Ymd);

$q = "SELECT * FROM users WHERE username='$username'";
$r = mysql_query($q);
$row = mysql_fetch_assoc($r);
$new_score = $row['sc'] + $score;

$new_q = "UPDATE users SET sc=" . $new_score . " WHERE username='$username'";
$new_r = mysql_query($new_q) or die(mysql_error());
mysql_query("INSERT INTO scores VALUES('pong','$username','$new_score','$date')") or die(mysql_error());
?>

try that...

SetroGamer
September 22nd, 2003, 11:55 PM
o.o Improvement, but that isn't my score...at least it doesn't say 0..

Jubba
September 23rd, 2003, 12:02 AM
what does it say? and should it say?

SetroGamer
September 23rd, 2003, 08:41 AM
It says the number of SC they have now, after addding their money from the game. It should be their score. I tried changing it to score but then it didn't work.