darklight Posted September 18, 2007 Share Posted September 18, 2007 How would I match up the password and id to the pass and id in mysql? Example: Site id = some id here Pass= Some pass here Link to comment https://forums.phpfreaks.com/topic/69705-matching-up-password/ Share on other sites More sharing options...
cooldude832 Posted September 18, 2007 Share Posted September 18, 2007 query for it, then check if the num_rows >0 if so its a match else its not Link to comment https://forums.phpfreaks.com/topic/69705-matching-up-password/#findComment-350242 Share on other sites More sharing options...
darklight Posted September 18, 2007 Author Share Posted September 18, 2007 I did...it failed to work.. Link to comment https://forums.phpfreaks.com/topic/69705-matching-up-password/#findComment-350247 Share on other sites More sharing options...
cooldude832 Posted September 18, 2007 Share Posted September 18, 2007 Then show what you did. Link to comment https://forums.phpfreaks.com/topic/69705-matching-up-password/#findComment-350249 Share on other sites More sharing options...
darklight Posted September 18, 2007 Author Share Posted September 18, 2007 $getpass = mysql_query("SELECT * FROM site where siteid='$rm' AND sitepassword='$sitepass'"); $row = mysql_fetch_row($getpass); $num = mysql_num_rows($getpass); if($num['sitepassword'] > 0) { header("Location:s/$rm.php"); } Link to comment https://forums.phpfreaks.com/topic/69705-matching-up-password/#findComment-350256 Share on other sites More sharing options...
freakstyle Posted September 18, 2007 Share Posted September 18, 2007 looks like you are checking the wrong data type. $num should not be an array. ex: if( $num > 0) { header("Location:s/$rm.php"); } side note: you should refrain from pulling the record with a password, if you need to you can always escape it. it leaves you open to injection attack. ref: http://us2.php.net/mysql_escape_string Good luck Link to comment https://forums.phpfreaks.com/topic/69705-matching-up-password/#findComment-350285 Share on other sites More sharing options...
darklight Posted September 18, 2007 Author Share Posted September 18, 2007 It still won't work. I have no clue what I'm doing...I just started mySQL. Link to comment https://forums.phpfreaks.com/topic/69705-matching-up-password/#findComment-350310 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.