Here is my code to retrive value from database
$query = "SELECT * FROM t_contact
WHERE id = {$project_details_id} LIMIT 1";
$all_post_info1 = mysql_query($query, $connection);
confirm_query($all_post_info1);
$project_details = mysql_fetch_array(show_project_details($project_details_id));
foreach ($project_details as $fieldname) {
echo $fieldname . "</br>";
}
And
function confirm_query($confirm_result) {
if (!$confirm_result) {
die("Database query failed1: " . mysql_error());
}
}
And i get output twice for each field. There are 27 column in my database and i get 54 output.
For example, there are name, email column in database and my output shows like
name
name
email
email
Some please tell me what is wrong with this code.
That’s because your
$project_detailsactually looks [something] like this:Try specifying
MYSQL_ASSOCin yourmysql_fetch_arraycall.