Ok, basically im trying to make a script that will, if the information exists in the database that the users entered into the 2 fields, it will echo out the entered username/pass combo so that a user can edit it. but im having trouble just getting the information to show up. Heres the script I got so far, and it LOOKS fine to me, but obviously isn't otherwise it would work. and please, don't criticize me too much, Im new to this, and know theres going to be some mistakes that some of you smarter users wouldn't make, I just need to know whats wrong, why its wrong, and how to fix it if you will. I removed the table name and replaced it with 'tablename' instead... im just paranoid (don't ask):
Code:
<?PHP
$user = addslashes(strip_tags($_POST['user']));
$pass = addslashes(strip_tags($_POST['pass']));
if ($_POST['check']) {
$name_check = @mysql_num_rows(mysql_query("SELECT * FROM `tablename` WHERE ( `user` LIKE '".$user."')"));
$pass_check = @mysql_num_rows(mysql_query("SELECT * FROM `tablename` WHERE ( `pass` LIKE '".$pass."')"));
$info_view = mysql_query("SELECT * FROM `tablename` WHERE ( `user` LIKE '".$user."') AND `pass` LIKE '".$pass."'") or die(mysql_error());
**if ($name_check == 1 && $pass_check == 1) {
** while ($i_view = mysql_fetch_array($info_view)) {
** print $i_view['user']."<br>";
** print $i_view['pass']."<br>";
}
else {
echo "Why didn't you work?"; }
}
}
?>
What happens currently is, I click "check", and the page reloads but nothing shows up. On the host im using, if theres any error in the code, the page won't load at all... which makes me think that im just mis-naming a variable somehwere or something... anyway umm... help away
Bookmarks