KillZoneZ Posted August 29, 2015 Share Posted August 29, 2015 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 27Warning: 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. Quote Link to comment https://forums.phpfreaks.com/topic/297977-trouble-executing-a-query/ Share on other sites More sharing options...
Solution ginerjm Posted August 29, 2015 Solution Share Posted August 29, 2015 You cannot mix the use of mysqli_* and MySQL_* functions. Drop the latter since they are deprecated. See the manual 1 Quote Link to comment https://forums.phpfreaks.com/topic/297977-trouble-executing-a-query/#findComment-1519894 Share on other sites More sharing options...
KillZoneZ Posted August 29, 2015 Author Share Posted August 29, 2015 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 ^^ Quote Link to comment https://forums.phpfreaks.com/topic/297977-trouble-executing-a-query/#findComment-1519898 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.