Jump to content

Recommended Posts

I have a page on my website that checks a persons details who wants to sign up for an account. One of the checks involves checking the username hasn't already been taken.

 

This involves checking the username the user entered on the signup page against usernames in the database.

 

Obviously I need to connect to the database to do this.

 

"checksignup.php" which performs the checks calls my db connection script "connect.php"

 

Checksignup.php is currently stalling: it is displaying this error message

 

Warning: mysql_query() [function.mysql-query]: Access denied for user 'www-data'@'localhost' (using password: NO) in /var/www/vhosts/propertyeagle.co.uk/httpdocs/checksignup.php on line 8

 

here is the beggining of checksignup.php, line 8 is marked with a *

 

<?php 

//Has the username already been taken? 

require_once ('./connect.php');
$username = $_POST['userid'];
$sql="SELECT * FROM user WHERE username='$username'";
* $result=mysql_query($sql);
$count=mysql_num_rows($result);
if ($count>0){$errorpresent=1; $_SESSION['$usernametaken']=1;}

 

 

And connect.php (I have checked the username password and database name, they are defintiely correct, but I have changed them here for the sake of security):

 

<?php


$host="localhost"; // Host name 
$username="bob"; // Mysql username 
$password="hello999"; // Mysql password 
$db_name="timsdb"; // Database name 



?>





 

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.