Código PHP:
Ver original
$username = ""; $password = ""; $displayname = ""; $profiles = ""; $email = ""; $comment = ""; $creditos= ""; $profiles = "N;"; } else { } $comment = $_POST["comment"]; $username = replacechars($username); $password = replacechars($password); $displayname = replacechars($displayname); $email = replacechars($email); $creditos = replacechars($creditos); $comment = replacechars($comment); if ($username == "" or $password == "") { $nouserpass = "true"; } else { $nouserpass = "false"; if($rowcheck == 1){ $userexists = "true"; } else { $userexists = "false"; mysql_query("INSERT INTO adu_udb (name,password,displayname,profiles,maxconnections,admin,enabled,mapexclude,debug,comment,email,added,addfin,addedby,changed,changedby) VALUES ('".$username."','".$password."','".$displayname."','".$profiles."','1','false','true','true','true','".$comment."','".$email."','".date("Y-m-d")."','".date("Y-m-d", strtotime("+1 Months"))."','".$_SESSION["loginuser"]."','','')") or die ("Error creating user"); // esta es la que le quita el credito al registar mysql_query("UPDATE adu_admins SET creditos= creditos - '".$creditos."' WHERE username='".$_SESSION["loginuser"]."'") or die ("Error editing admin user"); } } }
y quiero comprobar si la tabla de créditos esta en 0 pues denegarle el agregar el usuarios por no tener créditos.