georgebates Posted November 28, 2009 Share Posted November 28, 2009 Hi there, Here's my problem. I want to make it that I get a persons user name from a form and then it matches that username with the username on a mysql database and then gets the coresponding password for that username. I thought maybe this would work: <?php $username = $_REQUEST['catergory'] ; $password = mysql_query("SELECT password FROM users WHERE username = '$username'"); echo "$password" ?> But when i run this it just prints But when i run this it just prints Link to comment https://forums.phpfreaks.com/topic/183200-please-help-coding-help-needed/ Share on other sites More sharing options...
FaT3oYCG Posted November 28, 2009 Share Posted November 28, 2009 dont know what it prints coz u havent posted it but why is the username $_REQUEST['category']; ? EDIT: p.s. that is open to mysql insert attacks as you do not make sure the username has slashes, to do this you would see if magic_quotes_gpc was enabled and if not use the addslashes function. Link to comment https://forums.phpfreaks.com/topic/183200-please-help-coding-help-needed/#findComment-966851 Share on other sites More sharing options...
georgebates Posted November 28, 2009 Author Share Posted November 28, 2009 cause i just copied the textbox from another part of site and it kept the name. I read on this site that i should use mysql_fetch_assoc() but i don't know how to make it to get it to just read from the row that has the username that matches to the one entered by the user. Any ideas? Link to comment https://forums.phpfreaks.com/topic/183200-please-help-coding-help-needed/#findComment-966860 Share on other sites More sharing options...
FaT3oYCG Posted November 28, 2009 Share Posted November 28, 2009 i dont realy understand what you mean, it seems like you are new to PHP so if you want an example of a login script then search for and download JPMaser77's login script with admin features, it will show you how to properly cope with loggining in users and using cookies aswell as classes, if you dont understand classes then research them in the php manual but the classes used are prety simple. Link to comment https://forums.phpfreaks.com/topic/183200-please-help-coding-help-needed/#findComment-966869 Share on other sites More sharing options...
Daniel0 Posted November 28, 2009 Share Posted November 28, 2009 Double post. Locked. Link to comment https://forums.phpfreaks.com/topic/183200-please-help-coding-help-needed/#findComment-966880 Share on other sites More sharing options...
Recommended Posts