Jump to content

Trouble executing a query


KillZoneZ
Go to solution Solved by ginerjm,

Recommended Posts

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.

 

Link to comment
Share on other sites

You cannot mix the use of mysqli_* and MySQL_* functions. Drop the latter since they are deprecated. See the manual

 

Thanks, i'll keep that in mind. Changed everything to the equivalent in mysqli, updating parameters and it worked perfectly.

 

This forum is awesome ^^

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.