Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Connection Error; Not allowed to connect to MySQL Server
    text
    copied!<p>I am trying to make a registration page where it adds the information to a SQL Table. Here is my PHP code to do this... Can anyone tell me what the error with this is?</p> <pre><code>&lt;?php $con=mysqli_connect("Correct Website is here","Correct Username","Correct Pass","Correct DB"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $DBsql = mysql_query("SELECT username, email from Profiles"); $sql = mysql_fetch_array($DBsql); if(!($_POST['username'] == $sql['username']) &amp;&amp; ($_POST['email'] == $sql['email'])) { if ($_POST['password'] == $_POST['password2']){ $sql="INSERT INTO Profiles (firstName, lastName, username, email, password, region, group, verified) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[username]','$_POST[email]','$_POST[password]','$_POST[region]','member','no')"; }else{ echo '&lt;script type="text/javascript"&gt;' , 'window.alert("The passwords do not match.")' , '&lt;/script&gt;'; } } else { echo '&lt;script type="text/javascript"&gt;' , 'window.alert("That username or email is already in use.")' , '&lt;/script&gt;'; } mysqli_close($con); ?&gt; </code></pre> <p>It's giving these errors:</p> <pre><code>Warning: mysqli_connect() [function.mysqli-connect]: (HY000/1130): Host '31.170.161.96' is not allowed to connect to this MySQL server in /home/a5349216/public_html/register.php on line 2 Failed to connect to MySQL: Host 'ip' is not allowed to connect to this MySQL server Warning: mysql_query() [function.mysql-query]: Access denied for user 'username'@'localhost' (using password: NO) in /home/username/public_html/register.php on line 8 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/username/public_html/register.php on line 8 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/username/public_html/register.php on line 9 Warning: mysqli_close() expects parameter 1 to be mysqli, boolean given in /home/username/public_html/register.php on line 27 </code></pre> <p>Thanks in advanced.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload