MySQL Forums
Forum List  »  PHP

I'm stuck widht this query?
Posted by: Thomas Noe..
Date: September 17, 2008 06:47AM

Php code:

if(isset($_POST['godtaover'])) {
$p_id = $_SESSION['poeng_id'];

// Henter ut info om overføringen.
$q1 = mysql_query("SELECT * FROM poengoverforing WHERE id = $p_id");
while ( $w1 = mysql_fetch_array ($q1) ) {
$e1 = $w1['id'];
$e2 = $w1['fra'];
$e3 = $w1['til'];
$e4 = $w1['poeng'];
$e5 = $w1['pris'];
$e6 = $w1['dato'];
}
//...
// Henter ut info om avsender.
$q2 = mysql_query("SELECT * FROM brukere WHERE nick = $e2") or die (mysql_error());
while ( $w2 = mysql_fetch_array ($q2) ) {
$e7 = $w2['peng'];
}
//...
if($e5 >= $hent['peng']) {
echo "for lite peng";
}
else {
// ny poeng ballanse
$new_point_balance = $hent['poeng'] + $e4;
$r1 = $new_point_balance;
// ...
// ny penge ballanse
$new_money_balance = $hent['peng'] - $e5;
$r2 = $new_money_balance;
// ...
// ny penge ballanse (sender)
$new_money_balance_2 = $e5 + $e7;
$r3 = $new_money_balance_2;

// Oppdatere Poeng (mottaker)
mysql_query("UPDATE brukere SET poeng = $r1 WHERE id = ". $_SESSION['id'] ."");
// Oppdatere Peng (mottaker)
mysql_query("UPDATE brukere SET peng = $r2 WHERE id = ". $_SESSION['id'] ."");
// Oppdatere Peng (sender)
mysql_query("UPDATE brukere SET peng = $r3 WHERE nick = $e2");
// Sletter overføringen
mysql_query("DELETE FROM poengoverforing WHERE id = $p_id");

print ("Velykket!");
unset ($_SESSION['poeng_id']);
}


}


This line:

mysql_query("UPDATE brukere SET peng = $r3 WHERE nick = $e2");


it is comming up an error that says "Unknown column 'admin' in 'where clause'".
ehh lol?
what is wrong? i tried to set \" \" around the $e2, but than the eroor just disapear. and the problem is there..
But the problem is that, that that query dont work :S it wil not update the "brukere" table


edit:
i'm not so good in english :p since i'm norwegian ..



Edited 1 time(s). Last edit at 09/17/2008 06:49AM by Thomas Noe...

Options: ReplyQuote


Subject
Written By
Posted
I'm stuck widht this query?
September 17, 2008 06:47AM
September 17, 2008 09:16AM
September 17, 2008 10:31PM
September 21, 2008 05:40AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.