Hi, my code is: <?php mysql_connect("localhost", "admin", "admin") or die("Cannot connect to DB!"); mysql_select_db("padgate") or die("Cannot select DB!"); $username = ($_POST['username']); $password = ($_POST['password']); $login = "SELECT email, f_name FROM user WHERE email = '$username' AND password = '$password'"; $r = mysql_query($login) or die(mysql_error()."<Br /><br /.".$login); // don't use your SQL statement in your error. It will let malicious users know your table structure and open it up to sql injection. $count = mysql_num_rows($r); ?> Code (markup): and I want to put the f_name field result into a variable so it can be called by echo to display the name. Thanks, Gareth
You should escape the input though. The code at the moment is open to an SQL injection attack. Lookup mysql_escape_string
To create and escape the variables quickly (good if you have many), have a look at this post here: http://www.thewebsqueeze.com/forum/index.php?s=&showtopic=166&view=findpost&p=1191. Hope it helps in future!