Closed GoogleCodeExporter closed 8 years ago
Also, the function returns an array, when it should only get one social worker
if it is based on a unique ID
Original comment by kaylahay...@gmail.com
on 25 Apr 2012 at 9:50
Locally, I changed the function to:
function retrieve_UserProfile_SW($userProfileId)
{
connect();
$query="SELECT U.UserProfileID, U.UserCategory, S.SocialWorkerProfileID,S.Title,S.FirstName, S.LastName,U.UsernameID, U.Password, U.UserEmail, S.Phone, S.HospitalAffiliation,S.EmailNotification
FROM userprofile U JOIN socialworkerprofile S
ON U.UserProfileID= S.UserProfileID
WHERE U.UserCategory='Social Worker' AND S.SocialWorkerProfileID=\"".$userProfileId."\"";
$result = mysql_query ($query);
if (mysql_num_rows($result) <1)
{
mysql_close();
return false;
}
$result_row = mysql_fetch_assoc($result);
$user = new UserProfile($result_row['UserCategory'], $result_row['UserProfileID'], $result_row['UsernameID'],$result_row['UserEmail'],
$result_row['Password'],'null','null', 'null',
'null', 'null', $result_row['SocialWorkerProfileID'], $result_row['Title'],
$result_row['FirstName'], $result_row['LastName'], $result_row['HospitalAffiliation'], $result_row['Phone'],
$result_row['EmailNotification']);
mysql_close();
return $user;
}
and that returned the correct information
Original comment by kaylahay...@gmail.com
on 25 Apr 2012 at 9:53
Yeah. If you want to use his code, you have to specify the first element.
I was trying to figure out why it worked for me and not you. :)
Original comment by alisa.mo...@stjohns.edu
on 25 Apr 2012 at 9:58
I don't think it should return an array though, since it has the function
return false if there is more than one row anyways, right?
Original comment by kaylahay...@gmail.com
on 25 Apr 2012 at 10:01
I'm also having a problem with this function.
I just ran the new DB script. When try to run:
$SW = retrieve_UserProfile_SW(2);
echo $SW;
I get:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in
C:\Program Files\wamp\www\rmh-reservation-maker\database\dbUserProfile.php on
line 393
Original comment by alisa.mo...@stjohns.edu
on 26 Apr 2012 at 12:44
You can ignore Comment 5. For some reason I had no tables in my DB.
Original comment by alisa.mo...@stjohns.edu
on 26 Apr 2012 at 3:02
This warning message gets generated when a query fails, but no error message is
recorded. Don't ignore this message! Instead, make sure you handle query errors
properly
$result = mysql_query ($query)or die(mysql_error());
Original comment by bkmackellar
on 10 May 2012 at 9:07
Original comment by bkmackellar
on 2 Sep 2012 at 7:09
Original issue reported on code.google.com by
kaylahay...@gmail.com
on 25 Apr 2012 at 9:37