List Info

Thread: query issue




query issue
user name
2007-09-25 21:42:26
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 'myusernamelocalhost' (Using password:
NO)

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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "PHP & MySQL" group.
To post to this group, send email to phpmysqlgooglegroups.com
To unsubscribe from this group, send email to
phpmysql-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/phpmysql?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: query issue
user name
2007-10-15 19:09:03
check the connection ;)
 
<?
 
$db_serv=&quot;localhost";
$db_dbas=&quot;dbs";;
$db_user="usern";
$db_pass=&quot;passwd&quot;;

$conn=mysql_connect($db_serv,$db_user,$db_pass) or die ("can't connect to server&quot;);
 
mysql_select_db($db_dbas,$conn) or die ("can't select database&quot;);
&nbsp;
?>

 
On 9/25/07, Chenky < jminchenkogmail.com">jminchenkogmail.com> wrote:

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=&quot;mydatabase";

$link2 = mysql_connect("localhost&quot;, $usern, $passw);
if (! $link2) {
die(&quot;Connect error.&quot;);
}
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[&#39;usern&#39;];

}

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 ' myusernamelocalhost&#39; (Using password: NO)

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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "PHP & MySQL"; group.
To post to this group, send email to phpmysqlgooglegroups.com
To unsubscribe from this group, send email to phpmysql-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/phpmysql?hl=en
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )