Nieuw lid |
|
function add_hints3 (){
$username = $_SESSION['username'];
$sql = $this->query("SELECT * FROM ".DBTBLE." WHERE username = '$username'");
$num_rows = count($sql);
$credits = $this->create_show_credits($num_rows);
if ($credits >= '2' && $num_rows > 1 ){
$sql = $this->query("UPDATE cw_users SET hints = hints + 3 WHERE username = '".$username."'");
$sql = $this->query("UPDATE cw_users SET credits = credits - 3 WHERE username = '".$username."'");
}
else{
return "Niet genoeg credits om dit te kopen.";
}
}
function add_hints3 (){ $username = $_SESSION['username']; $sql = $this->query("SELECT * FROM ".DBTBLE." WHERE username = '$username'"); $credits = $this->create_show_credits($num_rows); if ($credits >= '2' && $num_rows > 1 ){ $sql = $this->query("UPDATE cw_users SET hints = hints + 3 WHERE username = '".$username."'"); $sql = $this->query("UPDATE cw_users SET credits = credits - 3 WHERE username = '".$username."'"); } else{ return "Niet genoeg credits om dit te kopen."; } }
Met als create_show_credits:
function show_credits(){
$username = $_SESSION['username'];
$sql = $this->query("SELECT * FROM ".DBTBLE." WHERE username = '$username'");
$result = $sql['sql'];
$num_rows = $sql['num_rows'];
$this->create_show_credits($result, $num_rows);
}
function create_show_credits($result, $num_rows) {
for($i=0; $i<$num_rows; $i++){
$userid=mysql_result($result,$i,"userid");
$credits=mysql_result($result,$i,"credits");
echo $credits;
}}
function show_credits(){ $username = $_SESSION['username']; $sql = $this->query("SELECT * FROM ".DBTBLE." WHERE username = '$username'"); $result = $sql['sql']; $num_rows = $sql['num_rows']; $this->create_show_credits($result, $num_rows); } function create_show_credits($result, $num_rows) { for($i=0; $i<$num_rows; $i++){ }}
Weigert hij nog altijd dienst.... |