You are here: query issue « PHP Language « IT news, forums, messages
query issue

Posted by Chenky on 09/27/07 01:31

I've been trying to nut this error out for the last three days to no
success. Here's the code:

$usern = "myusername";
$passw = "mypassword";
$db="mydatabase";


$link2 = @mysql_connect("localhost", $usern, $passw);
if (! $link2) {
die("Connect error.");


}


mysql_select_db($db) or die("DB Select error");

$status = mysql_query("SELECT * FROM members WHERE usern='$user'");


while ($display = mysql_fetch_array($status)) {


print $display['usern'];



}


mysql_close($link2);

(Obviously Ive change the real database name, user and password, but
rest assured the real ones are correct - this i have triple and
quadruple checked)


On a whim I changed the $status variable to:
$status = mysql_query("SELECT * FROM members WHERE usern='$user'") or
die (mysql_error());
and was given this error:


Access denied for user 'myusername@localhost' (Using password: NO)


This is what confuses me - why isn't it recognising the use of
password? All help appreciated.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация