I have a PHP function view_activated_profile();
. I want it to return a result for two different queries. I don't know if it's possible or not, but there must be some way to achieve full result on another page.
I have two pages, functions.php and profile.php. In functions.php, I have defined the functions:
$activated = check_activated();
while($row = mysql_fetch_array($activated))
{
$userid = $row['admin_id'];
}
$query = "SELECT * from cv_user_profile WHERE admin_id=$userid";
$result = mysql_query($query);
$array1 = mysql_fetch_array($result);
$query2 = "SELECT * from cv_adminlogin WHERE admin_id=$userid";
$result2 = mysql_query($query2);
$array2 = mysql_fetch_array($result2);
$overall = $array1.$array2;
return $overall;
Then I called the function in profile.php like this:
$user_profile = view_activated_profile();
while($row = mysql_fetch_array($user_profile))
{
$showfullname = $row['full_name'];
$showjob_title = $row['job_title'];
$showemail = $row['email_address'];
$showdob = $row['dob'];
$showmobile = $row['mobile'];
$showphone = $row['phone'];
$shownationality = $row['nationality'];
$showprofilepic = $row['profile_image'];
$showaddress = $row['address'];
$showaboutme = $row['about_me'];
$showlastupdated = $row['last_updated'];
}
I get this error on profile.php page:
Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in C:\xampp\htdocs\aptanaProjects\pakistanihaider\admin\profile.php on line 30
Below are my database tables that i have used in queries:
What i am doing wrong? How to get result of both queries successfully on profile.php?