Jump to content

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


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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.