Sagewire Logo

query issue

2 Message(s) by 2 Author(s) originally posted in php language


From: Chenky Date:   Wednesday, September 26, 2007
I have 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 = @xxxxxxxxxxx("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@xxxxxxxxxxx' (Using password: NO)This is what confuses me - why is not it recognising the use of
password? All help appreciated.


From: C. Date:   Thursday, September 27, 2007
wrote in message:
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 = @xxxxxxxxxxx("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@xxxxxxxxxxx' (Using password: NO)
This is what confuses me - why is not it recognising the use of
password? All help appreciated.



try:

error_reporting(E_ALL);
...
$link2 = mysql_connect("localhost", $usern, $passw);

and also:

error_reporting(E_ALL);
...
$link2 = mysql_connect('127.0.0.1', $usern, $passw);

If you're still stuck, try with the mysql command line client:

mysql -h localhost -u myusername -p mypassword

HTH

C.



Next Message: debug and __LINE__ , __FILE__


Blogs related to query issue

COPR Query
Mine has my daughter listed as a dependent. My wife's does not. Problem when doing the landing hop over and back ? All the details on all 3 documents are correct but just this 'missing' info on my wife's. I presume it's because I am the ...

PHP General :: RE: Slow query, beginner problem
Author: lostboy Posted: Tue Sep 18, 2007 10:00 pm (GMT 2) Topic Replies: 3 do you have any indexes on the tables? they usually help to speed up the query. Lostboy Cat, the other other white meat Please read Posting Etiquette before ...

query issue
comp.lang.php: query issue.

MySQL Java Login Issues
As� como se necesita un statement.getResulSet para obtener los valores que * el query estaba buscando en la BD. */ ConnectionDB.setStatement(statement = (Statement) connection.createStatement()); statement.execute(SQLStatement); ...

Issues and Bugs :: RE: Servoyism? controller.setSelectedIndex ...
If you do a controller.loadAllRecords(), Servoy will fire a SELECT * query to the database. This can result in 100 records or in 100.000.000 records. Servoy will never transfer all records to the client as you can easily understand if ...

Paging Problem
Now let us start executing the query with variables $eu and $limit set at the top of the page/////////// $query=" SELECT * FROM student_adv limit $eu, $limit "; $result=mysql_query($query); echo mysql_error(); ...


Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional