Jump to content

Recommended Posts

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)

Link to comment
https://forums.phpfreaks.com/topic/134307-solved-annoying-errors/
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.