Btown2 Posted October 23, 2006 Share Posted October 23, 2006 Just wondering how i can pull data out of my DB. Heres what i attempted so far, but it returns "Resource id#4"[code]<?phpinclude "mysql_connect.php";$username=$_POST['namebox'];$entered_password=$_POST['pbox'];$query ="SELECT password FROM users WHERE (name = \"$username\")";$password = mysql_query($query);echo $password;?>[/code] Quote Link to comment Share on other sites More sharing options...
extrovertive Posted October 23, 2006 Share Posted October 23, 2006 [code=php:0]$username=$_POST['namebox'];$entered_password=$_POST['pbox'];$query ="SELECT password FROM users WHERE name = '$username' LIMIT 1";//mysql_query will execute your SQL query and return the resource$result = mysql_query($query);//then you need to use a query function to retrive all the rows based on your query resultlist($password) = mysql_fetch_row($result);//output your passwordecho $password;[/code] Quote Link to comment Share on other sites More sharing options...
fenway Posted October 24, 2006 Share Posted October 24, 2006 You'll probably want to iterate through the result set:while( list($password) = mysql_fetch_row($result) ) { echo $password;} Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.