Jump to content

Help Me


aruns

Recommended Posts

Hai guys.,

Now i am creating a shopping cart but we had this

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mastern/public_html/newadmin/login.php on line 13

 

This is the script

 

$result = mysql_query("select * from" . ADMIN_LOGIN . "where email='$email' and password = '$pass'");

$res = mysql_fetch_array($result);

 

$ad_user = $res['user'];

$ad_pass = $res['password'];

 

Thanks all

Arun

Link to comment
Share on other sites

They are include files... For example you write your db login in a separate file and then to include that file in your script as

 

<?

include ('dblogin.inc.php');

?>

 

its gonna include all the information from that file.

Its better practice then putting it your page script incase you mess up and then someone can see your php script and then see your db username and password.

Also stops your from declaring the db login info on every page, you just need do include ('dblogin.inc.php');

Link to comment
Share on other sites

Hi vicodin ,

      Thaks for reply . I understood but still little doubt when i am put database connection script like connection.inc.php. where can i include this file for whole project and how it is possible.

 

Thanks

Arun

 

Link to comment
Share on other sites

you told me "stops your from declaring the db login info on every page, you just need do include ('dblogin.inc.php');".i try to do this just i put db connection and saved db.inc.php included it in index.php. but the other pages says

 

Warning: mysql_query() [function.mysql-query]: Access denied for user 'mastern'@'localhost' (using password: NO) in /home/mastern/public_html/newadmin/account.php on line 40

Link to comment
Share on other sites

you told me "stops your from declaring the db login info on every page, you just need do include ('dblogin.inc.php');".i try to do this just i put db connection and saved db.inc.php included it in index.php. but the other pages says

 

Warning: mysql_query() [function.mysql-query]: Access denied for user 'mastern'@'localhost' (using password: NO) in /home/mastern/public_html/newadmin/account.php on line 40

 

It means either:

1) The user doesn't exist.

2) The user does exist but the password is wrong.

3) The user does exist but does not have access to that specific database which you chose.

Link to comment
Share on other sites

Try this in your include file:

$host = "localhost";
$usr = "username";
$pwd = "password";
$db = "database_name";

 

and then include the file in the page in question and do this to start your db query:

 

$connection = mysql_connect($host,$usr,$pwd);
$query= mysql_db_query($db, "SELECT * from table", $connection);}

 

Link to comment
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.