Akenatehm Posted November 26, 2008 Share Posted November 26, 2008 My php script was working before, now it is returning a bunch of errors about connecting to the mysql database. Here is the script: <?php include "../connect.php"; if(isset($_POST['submit'])) { $username=$_POST['username']; $password=$_POST['password']; $email=$_POST['email']; if(strlen($username)<1) { print "You did not enter a username."; } else if(strlen($password)<1) { print "You did not enter a password."; } else { $insert="Insert into users (username,pass,email) values('$username','$password','$email')"; mysql_query($insert) or die("Could not insert comment" . mysql_error()); echo "User Added. <A href''<a href=\"home.html\">Click here</a> To Go Home."; } } ?> and here is the connect.php include file <?PHP $db = mysql_connect ("localhost", "username", "password"); if (!$db) die ("No Database Found"); if (!mysql_select_db ("database",$db)) die("No Database Selected"); ?> It is returning the following erros: Warning: include(../connect.php) [function.include]: failed to open stream: No such file or directory in /home/kaurlcom/public_html/relayadmin/add_user/add_user.php on line 3 Warning: include(../connect.php) [function.include]: failed to open stream: No such file or directory in /home/kaurlcom/public_html/relayadmin/add_user/add_user.php on line 3 Warning: include() [function.include]: Failed opening '../connect.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/kaurlcom/public_html/relayadmin/add_user/add_user.php on line 3 Warning: mysql_query() [function.mysql-query]: Access denied for user 'username'@'localhost' (using password: NO) in /home/kaurlcom/public_html/relayadmin/add_user/add_user.php on line 37 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/kaurlcom/public_html/relayadmin/add_user/add_user.php on line 37 Could not insert commentAccess denied for user 'username'@'localhost' (using password: NO) Quote Link to comment Share on other sites More sharing options...
Philip Posted November 26, 2008 Share Posted November 26, 2008 include "../connect.php"; you must include the full path, i.e.: /home/username/public_html/folders/connect.php Quote Link to comment Share on other sites More sharing options...
timmah1 Posted November 26, 2008 Share Posted November 26, 2008 Did you move the connect.php file? According to the error, it can't find it I haven't included full paths on the scripts that I have written, just make sure it's in the correct place Quote Link to comment Share on other sites More sharing options...
Akenatehm Posted November 26, 2008 Author Share Posted November 26, 2008 I am pretty sure I haven't moved it but I will add the full path anyway. Thanks Quote Link to comment 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.