Vivid Lust Posted January 29, 2010 Share Posted January 29, 2010 Hi, with php, how do i get a value that i am trying to get, from a mysql database if the sql is: SELECT email FROM members WHERE username = username $email = thanks! Link to comment https://forums.phpfreaks.com/topic/190281-getting-value-from-a-database/ Share on other sites More sharing options...
akitchin Posted January 29, 2010 Share Posted January 29, 2010 you need to use some or all of the following functions: mysql_connect mysql_select_db mysql_query mysql_fetch_array mysql_result there are also a number of tutorials if you simply google the phrase "using mysql with php". Link to comment https://forums.phpfreaks.com/topic/190281-getting-value-from-a-database/#findComment-1003881 Share on other sites More sharing options...
Vivid Lust Posted January 29, 2010 Author Share Posted January 29, 2010 Do i still use mysql_fetch_array() in a while loop if i only want to get one value? Link to comment https://forums.phpfreaks.com/topic/190281-getting-value-from-a-database/#findComment-1003885 Share on other sites More sharing options...
akitchin Posted January 29, 2010 Share Posted January 29, 2010 no, there's no need - you can just assign the return value from mysql_fetch_array() to a variable. that will give you an array, so you'll need to specify the column as the array's index: echo $variable['column_name']; Link to comment https://forums.phpfreaks.com/topic/190281-getting-value-from-a-database/#findComment-1003886 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.