Jump to content

Added a field but it doesn't return in a querry array


lucio

Recommended Posts

Hi there, I recently modified an exsisiting PHP/MySQL website to include an additional field but when I try to use an exsisting function called user_details, it doesn't collect the new field

 

		
function user_details($id)
{
$user = array();

$sql = "
	SELECT u.*, IF(u.first_name!='' AND u.last_name!='', CONCAT(u.first_name, ' ', u.last_name), u.company) AS user_name, b.name AS business_name, wdyfu.name AS where_did_you_find_us_name
	FROM users AS u
	LEFT JOIN businesses AS b
	ON u.business = b.id
	LEFT JOIN where_did_you_find_us AS wdyfu
	ON u.where_did_you_find_us = wdyfu.id
	WHERE u.id='$id'
	GROUP BY u.id
	";
$que = mysql_query($sql);
if ($que)
{
	$user = mysql_fetch_assoc($que);
}

return $user;
}

 

For other fields in the table, it lets me return them in PHP via

 

<? echo($user['postal_code']) ?>

 

but when I try the same with account in place of postal_code, it fails. I'm completely stuck as to why it's not working!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.