Jump to content

KillZoneZ

Members
  • Content Count

    23
  • Joined

  • Last visited

Community Reputation

0 Neutral

About KillZoneZ

  • Rank
    Member
  1. It did actually, but non of them resembled to something similar to my code, that's why i thought i would ask.
  2. My code is returning Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given and i cant find out why Please help $CheckUsername = mysqli_query($conn,"SELECT Username FROM users WHERE Username='$Username'"); $CheckEmail = mysqli_query($conn,"SELECT E-Mail FROM users WHERE E-Mail='$Email'"); $CheckBetaKey = mysqli_query($conn,"SELECT BetaKey FROM betakey WHERE BetaKey='$BetaKey' AND E-Mail='$Email'"); if ($Password != $PasswordAgain || ($CheckUsername != FALSE) || ($CheckEmail != FALSE) || (mysqli_num_rows($CheckBetaKey) != 1)) { if ($Password != $PasswordAgain) { echo "• Passwords did not match."; } else {} if ($CheckUsername != FALSE) { echo "• That Username has already been taken."; } else{} if ($CheckEmail != FALSE) { echo "• That E-Mail has already been registered."; } else{} if (mysqli_num_rows($CheckBetaKey) != 1) { echo "• Either that Beta Key has already been used or isn't for the specified e-mail address."; } else{} } else { $InsertUser = mysqli_query($conn,"INSERT INTO users (Username,Password,E-Mail,BetaKey) VALUES ('$Username','$Password','$E-Mail','$BetaKey')"); $DeleteBetaKey = mysqli_query($conn,"DELETE * FROM betakey WHERE BetaKey='$BetaKey' AND Mail='$Email'"); header ("Location: Index.php"); } Also, the second condition: if ($CheckUsername != FALSE) { echo "• That Username has already been taken."; } else{} is returning true even though there is no User in the database. The same happens with the last one. if (mysqli_num_rows($CheckBetaKey) != 1) { echo "• Either that Beta Key has already been used or isn't for the specified e-mail address."; } else{} }
  3. Im not quite catching it sorry, could you give me an example? @Edit Been thinking on other ways to check if a value already exists in the database and thought this: Could i use mysqli_num_rows to check how many rows the result set has and if it was bigger than 0 it would mean that there is already a field with the same value on the database. Would that work? Thanks for the quick answer btw
  4. Hello, For some reason this if condition is returning true even though it is false, that is, instead of echoing the sentence should have gone forward because it was inputed correctly on the form. Here is the code: if($BetaKey != $result=mysqli_query($conn,"SELECT BetaKey FROM betakey WHERE BetaKey = '$BetaKey'")) { echo "• Either that Beta Key has already been used or isnt for the specified e-mail."; } Form used in the php code's code: <form method="post" action="RegisterCheckUp.php"> <span id="UsernameLabel">Username:<span class="required">*</span></span> <br> <input type="text" maxlength="16" id="Username" name="username" placeholder="Username" value="" required="required"/> <br> <span id="PasswordLabel">Password:<span class="required">*</span></span> <br> <input maxlength="16" type="password" id="Password" name="password" placeholder="Password" value="" required="required"/> <br> <span id="PasswordAgainLabel">Repeat Password:<span class="required">*</span></span> <br> <input type="password" id="PasswordAgain" name="passwordagain" placeholder="Password(Again)" value="" required="required"/> <br> <span id="E-MailLabel">E-Mail:<span class="required">*</span></span> <br> <input type="email" id="E-Mail" name="email" placeholder="E-Mail" value="" required="required"/> <br> <span id="BetaKeyLabel">Beta Key:<span class="required">*</span></span> <br> <input id="BetaKey" required="required" name="betakey" type="text" maxlength="10" placeholder="Your Beta Key" /> <span id="Warning">All fields are required</span> <input name="submit" type="submit" value="Sign Up" id="SignUpButton"/> </form> In the attached files there is an image of the database table. Thank You
  5. Thanks, i'll keep that in mind. Changed everything to the equivalent in mysqli, updating parameters and it worked perfectly. This forum is awesome ^^
  6. So, this is my code: <?php //MySQL Information $servername = "****"; $username = "****"; $password = "****"; $dbname = "****"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } //Define Variable Inputed by the User $Mail = $_POST['email']; //Inserting Mail Query $result = mysql_query("INSERT INTO betakey (Mail) VALUES ('$Mail')"); //This is where the error happens //Checking if the Mail is a duplicate if ($result === FALSE) { //Checking if the error is a duplicate error or not if (mysql_errno() == 1022) { echo("That E-Mail address is already registered for the closed alpha"); } else { die(mysql_error()); } } //Redirecting if it's not a duplicate and has been inserted into the DB elseif ($result === TRUE) { header ("Location: BetaRegistration.php"); } ?> I am getting this error: Warning: mysql_query(): No connection could be made because the target machine actively refused it. in H:\root\home\offspc-001\www\joaopteixeira\EvolutionRPG\EmailCheckUp.php on line 27 Warning: mysql_query(): A link to the server could not be established in H:\root\home\offspc-001\www\joaopteixeira\EvolutionRPG\EmailCheckUp.php on line 27 No connection could be made because the target machine actively refused it.
  7. I added the quotes and it is still not working. Same error. The error refers to line 27: $MailInsert = $dbname->query("INSERT INTO betakey (Mail) VALUES ('$Mail')"); And it says Call to a member function query() on a non-object
  8. I want to make it check the database for an equal value to the one inputed by the user and if so echo a sentence saying it is already registered, and if it is not, it would just insert the data into the database table. Here's my code: <?php $servername = "***"; $username = "***"; $password = "***"; $dbname = "a3108948_evorpg"; $Mail = $_POST['email']; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $Mail = $_POST['email']; $MailInsert = $dbname->query("INSERT INTO betakey (Mail) VALUES ($Mail)"); $SearchEmail = $dbname->query("SELECT (Mail) FROM betakey WHERE Mail = $Mail"); if ($SearchEmail->num_rows > 0) { echo "That Email is already registered for the closed alpha"; } else { } $conn->close(); ?> This is the error i get: Fatal error: Call to a member function query() on a non-object in /home/a3108948/public_html/BetaRegistration.php on line 27
  9. Really simple question: I want to assign a query's result to a variable but have no idea on how doing it
  10. I forgot to mention it in the topic but yeah i used it on a element and yes it was between the style tags, still not working I dont really understand why. Tried this: @font-face { font-family: 'Pixelated'; font-style: normal; font-weight: 300; src: local('Pixelated'), local('Pixelated.ttf'), url(pixelated.ttf) format('ttf'); } Still not working.
  11. I'm trying to add a custom font do my website, but for some reason it isn't working. This is what i've tried: Added this to the css file(Didn't work): @font-face { font-family: Pixelated; src: url(pixelated.ttf); } Changed to this(Also didn't work): @font-face { font-family: Pixelated; src: local('pixelated.ttf'); } Lastly tried to add them both (one at a time) it in the php file under style, and still didn't work.
  12. Yes it is gradients, however i think i'm going with maxxd's idea, thank you very much both of you ^^
  13. I dont think so if there is i cant find it
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.