What is wrong with this php/MySQL code on my web site?

Glenn

Member
When I query my database:
$result= mysql_query("SELECT * FROM users WHERE userName = '$username'");

it is not responding correctly so I "echo"ed my $result and it gave me:
Resource id #2


Why would it do this?
 
Glenn,
To access the data selected, you need to next use one of the mysql_fetch functions. I suggest you review some php/MYSQL tutorials. There are several available if you search on Google.
 

n1c0_ds

New Member
I will urge you to read about SQL injection.If $username contains anything dangerous, your site could easily be hacked.

Stay safe!
 
Top