Jump to content

Recommended Posts

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

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.

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?

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.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.