php - How to access elements of the return value of mysql_fetch_array? -


$con = mysql_connect("servername","username","password");         if (!$con){die('could not connect: ' . mysql_error());}             mysql_select_db("appiness", $con);      $result= mysql_query("select * country");     while($answer= mysql_fetch_array($result))     {         echo $answer;     } 

when write gives me array of 194 elements when echo them writes arrayarrayarray....... 194 times idea why not giving names of countries?

you have specify column want out of $answer-array. if column name name:

echo $answer["name"] 

Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -