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] Link to comment https://forums.phpfreaks.com/topic/24791-php-newb-here/ 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] Link to comment https://forums.phpfreaks.com/topic/24791-php-newb-here/#findComment-112914 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;} Link to comment https://forums.phpfreaks.com/topic/24791-php-newb-here/#findComment-113458 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.