hello, all -
i've got a SELECT statement that isn't returning any errors but is simply not working. all test points leading up to the query confirm a connection to the database but selecting a record just doesn't seem to go through. the intention is simple - just to retrieve the password which correlates to a given username. i'll admit i'm fairly new to php/mysql but have had quite a bit of access experience in the past... just doesn't seem to be coming together, though. thanks in advance
I should also mention that the scenario implied by the code below is not at all intended to be deployed. when thinking of tables of related records it was just the first thing to come to mind in terms of dummy-data.
mySQL v5.1 (XAMPP installation)
"logintable" consists of 3 fields (id, username, password)
<html>
<body>
<form action="login.php" method="POST">
Username: <input type="text" name="userName" value="user2"><br>
<input type="submit" value="Click"><p>
</form>
<?php
$user = $_POST['userName'];
mysql_connect("localhost","root","dbopwd") or die(mysql_error());
mysql_select_db("login") or die(mysql_error());
echo mysql_query("SELECT password FROM logintable WHERE username='$user'");
?>
</body>
</html>