mysql_fetch_array() Help needed


#1

This is my problem:
PHP version 4.3.4
Mysql 4.0.18
Apache 1.3.24
System WinXP

I create a connection to my database(Mysql),then I create a sql query
to retrive the password associated to a username

$sqlcheck=“SELECT Password,pass FROM User WHERE Name = '”.$_POST[‘uname’]."’";

$risultato=mysql_query($sqlcheck);

while ($info = mysql_fetch_array($risultato,MYSQL_BOTH)); {
printf ("%s
Password: %s,%s,%s
ris: %s
N: %d
",$sqlcheck,$info[‘password’],$info[1],$info[0],$risultato,mysql_num_rows($risultato));
}

This is the output :

"SELECT Password,pass FROM User WHERE Name = ‘aa’ "
(aa is a name that exist in the database)
"Password: "
“ris:Resource id #5
“N:1”

I don’t understand what I’m doing wrong.
(The sql query is ok , I tried it and it work with SQLyog)
(Almost forgotten the connection is ok , I used it to insert the data)

I think the problem is the mysql_fetch but I’ve tryed the other one
_row but it doesn’t work.

Can someone help me?

Thank.

p.s. Sorry for my bad english , I hope you understand the meaning


#2

Use print_r() or var_dump() on your $info array (which is a row). You will see all the values it contain and what they are associated with.