473,763 Members | 3,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can not view company profile after user login: session problem??

127 New Member
The company profile showed blank after user login and click the company profile button. Supposed the company profile should not be blank and will show the company information which call from database. I use the session in login page. Thus, in the begining of companyProfile' s coding, i put session_start() ;. What is the problem of my php code?? Thanks..

[PHP]<?php
ob_start();
session_start() ;

include_once("d atabase.php");

if($_GET['ret'] == 'general' ){

//User General Information Retriving
//find the user
$general_result = mysql_query("SE LECT * FROM company WHERE username='{$_SE SSION['username']}'")
or die(mysql_error ());
$general_row = mysql_fetch_arr ay( $general_result ); //set $row to result

//table to display general user inforamtion
echo "<hr><table width=100% border=0>
<tr>
<td><div align=center>
<img src= width=100 height=100>
</div></td>
</tr>
<tr>
<td><table width=70% border=0 align=center>
<tr>
<td width=40% ><font face=Arial size=2>Company Name</font></td>
<td width=2%>:</td>
<td width=58%>" . $general_row['companyName'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Company Type</font></td>
<td>:</td>
<td>" . $general_row['companyType'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Contact Name</font></td>
<td>:</td>
<td>" . $general_row['contactName'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Descript ion</font></td>
<td>:</td>
<td>" . $general_row['description'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Username </font></td>
<td>:</td>
<td>" . $general_row['username'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Password </font></td>
<td>:</td>
<td>" . $general_row['password'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Email Address</font></td>
<td>:</td>
<td>" . $general_row['emailAdd'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>ContactN umber</font></td>
<td>:</td>
<td>" . $general_row['contactNum'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Fax</font></td>
<td>:</td>
<td>" . $general_row['fax'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Contact Addresss</font></td>
<td>:</td>
<td>" . $general_row['contactAddress '] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>City </font></td>
<td>:</td>
<td>" . $general_row['city'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Postcode </font></td>
<td>:</td>
<td>" . $general_row['postcode'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>State</font></td>
<td>:</td>
<td>" . $general_row['state'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Country</font></td>
<td>:</td>
<td>" . $general_row['country'] . "</td>
</tr>
</table></td>
</tr>
</table><br><br>" ;



}//end selection on general information retriving


?>[/PHP]
Feb 1 '07 #1
15 2291
Motoma
3,237 Recognized Expert Specialist
The company profile showed blank after user login and click the company profile button. Supposed the company profile should not be blank and will show the company information which call from database. I use the session in login page. Thus, in the begining of companyProfile' s coding, i put session_start() ;. What is the problem of my php code?? Thanks..

[PHP]<?php
ob_start();
session_start() ;

include_once("d atabase.php");

if($_GET['ret'] == 'general' ){

//User General Information Retriving
//find the user
$general_result = mysql_query("SE LECT * FROM company WHERE username='{$_SE SSION['username']}'")
or die(mysql_error ());
$general_row = mysql_fetch_arr ay( $general_result ); //set $row to result

//table to display general user inforamtion
echo "<hr><table width=100% border=0>
<tr>
<td><div align=center>
<img src= width=100 height=100>
</div></td>
</tr>
<tr>
<td><table width=70% border=0 align=center>
<tr>
<td width=40% ><font face=Arial size=2>Company Name</font></td>
<td width=2%>:</td>
<td width=58%>" . $general_row['companyName'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Company Type</font></td>
<td>:</td>
<td>" . $general_row['companyType'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Contact Name</font></td>
<td>:</td>
<td>" . $general_row['contactName'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Descript ion</font></td>
<td>:</td>
<td>" . $general_row['description'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Username </font></td>
<td>:</td>
<td>" . $general_row['username'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Password </font></td>
<td>:</td>
<td>" . $general_row['password'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Email Address</font></td>
<td>:</td>
<td>" . $general_row['emailAdd'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>ContactN umber</font></td>
<td>:</td>
<td>" . $general_row['contactNum'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Fax</font></td>
<td>:</td>
<td>" . $general_row['fax'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Contact Addresss</font></td>
<td>:</td>
<td>" . $general_row['contactAddress '] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>City </font></td>
<td>:</td>
<td>" . $general_row['city'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Postcode </font></td>
<td>:</td>
<td>" . $general_row['postcode'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>State</font></td>
<td>:</td>
<td>" . $general_row['state'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Country</font></td>
<td>:</td>
<td>" . $general_row['country'] . "</td>
</tr>
</table></td>
</tr>
</table><br><br>" ;



}//end selection on general information retriving


?>[/PHP]

Not sure...It could very well depend on what is inside the database.php file. Have you put echos inside your if statement to make sure you are in fact getting in there?
Feb 1 '07 #2
bb nicole
127 New Member
I know what you are talking about... The database.php is just connect to server and database.
If i delete
[PHP]include_once("d atabase.php");[/PHP]
and add
[PHP]//connect to server and select database
$conn = mysql_connect(" localhost", "root", "")
or die (mysql_error()) ;
mysql_select_db ("ums e-job portal",$conn) or die(mysql_error ());[/PHP]

The result also same, it will display the blank page...
What is the problem??
Thanks..
Feb 1 '07 #3
Motoma
3,237 Recognized Expert Specialist
I know what you are talking about... The database.php is just connect to server and database.
If i delete
[PHP]include_once("d atabase.php");[/PHP]
and add
[PHP]//connect to server and select database
$conn = mysql_connect(" localhost", "root", "")
or die (mysql_error()) ;
mysql_select_db ("ums e-job portal",$conn) or die(mysql_error ());[/PHP]

The result also same, it will display the blank page...
What is the problem??
Thanks..
Put an echo inside your if() block to see if you are getting in there.
Feb 1 '07 #4
bb nicole
127 New Member
Sorry.. I don't really understand what you said... I already put echo inside the if() statement as below to dispaly the company profile, is it like this??
[PHP]<?
echo "<hr><table width=100% border=0>
<tr>
<td><div align=center>
<img src= width=100 height=100>
</div></td>
</tr>
<tr>
<td><table width=70% border=0 align=center>
<tr>
<td width=40% ><font face=Arial size=2>Company Name</font></td>
<td width=2%>:</td>
<td width=58%>" . $general_row['companyName'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Company Type</font></td>
<td>:</td>
<td>" . $general_row['companyType'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Contact Name</font></td>
<td>:</td>
<td>" . $general_row['contactName'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Descript ion</font></td>
<td>:</td>
<td>" . $general_row['description'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Username </font></td>
<td>:</td>
<td>" . $general_row['username'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Password </font></td>
<td>:</td>
<td>" . $general_row['password'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Email Address</font></td>
<td>:</td>
<td>" . $general_row['emailAdd'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>ContactN umber</font></td>
<td>:</td>
<td>" . $general_row['contactNum'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Fax</font></td>
<td>:</td>
<td>" . $general_row['fax'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Contact Addresss</font></td>
<td>:</td>
<td>" . $general_row['contactAddress '] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>City </font></td>
<td>:</td>
<td>" . $general_row['city'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Postcode </font></td>
<td>:</td>
<td>" . $general_row['postcode'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>State</font></td>
<td>:</td>
<td>" . $general_row['state'] . "</td>
</tr>
<tr>
<td><font face=Arial size=2>Country</font></td>
<td>:</td>
<td>" . $general_row['country'] . "</td>
</tr>
</table></td>
</tr>
</table><br><br>" ;

?>[/PHP]
Feb 1 '07 #5
bb nicole
127 New Member
Can anyone help??? What is the problem with my coding??? Why it is a blank page after click inside it???
Feb 2 '07 #6
Motoma
3,237 Recognized Expert Specialist
Can anyone help??? What is the problem with my coding??? Why it is a blank page after click inside it???
The only reason I can see for not seeing anything is that your first test:
if($_GET['ret'] == 'general')
isn't succeeding.
Feb 2 '07 #7
bb nicole
127 New Member
Thanks, i will try to look at it... :)
Feb 2 '07 #8
bb nicole
127 New Member
I try to edit my company profile, which the user can view their profile after they login... But it still show the blank page... But when i move it outside the htdocs and press F12, it will show the table... And i try to check it one by one, which means i try to cut the interface out, and it able display the interface... Emm.. I really don't what is the problem... Thanks... Below is my coding for company profile...

[PHP]<?php
//ob_start();
session_start() ;

//connect to server and select database

$conn=mysql_con nect("localhost ", "root", "") or die (mysql_error()) ;
mysql_select_db ("ums e-job portal", $conn) or die(mysql_error ());


// construct SQL statement
$sql = mysql_query("SE LECT * FROM company WHERE company_ID='{$_ SESSION['company_ID']}'");

while($rows=mys ql_fetch_array( $sql)){

//table to display company profile

echo" <div align='center'> <font face='Arial' size='3'><stron g>Company Profile</strong></font></div>
<table width='48%' border='1'>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>Compan y Name</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['companyName']}</strong></td>
</tr>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>Compan y Type</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['companyType']}</strong></td>
</tr>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>Contac t Name</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['contactName']}</strong></td>
</tr>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>Descri ption</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['description']}</strong></td>
</tr>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>Userna me</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['username']}</strong></td>
</tr>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>Passwo rd</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['password']}</strong></td>
</tr>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>Email Address</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['emailAdd']}</strong></td>
</tr>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>Contac tNumber</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['contactNum']}</strong></td>
</tr>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>Fax</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['fax']}</strong></td>
</tr>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>Contac t Addresss</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Verdana' size='2'>{$rows['contactAdd']}</strong></td>
</tr>]

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>City</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['city']}</strong></td>
</tr>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>Postco de</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['postcode']}</strong></td>
</tr>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>State</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['state']}</strong></td>
</tr>

<tr>
<td width=27% align=left bgcolor='#E8E8E 8'>&nbsp;<font face='Arial' size='2'>Countr y</strong></td>
<td width=73% align=left bgcolor='#f1f1f 1'>&nbsp;<font face='Arial' size='2'>{$rows['country']}</strong></td>
</tr>

</table>";

}


//end selection on general information retriving


?>
[/PHP]
Feb 4 '07 #9
bb nicole
127 New Member
Hi... Is it anyone have an idea how to edit or repair my code, i really no idea...
Emm... i think the code is correct, but don't why the result is the blank page..
It doesn't show any error... Is it the coding can't get the user id from database?
Feb 4 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3655
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore my settings if my profile became tampered with or corrupt. Is there any sample code available out there? -Robert
4
1466
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore my settings if my profile became tampered with or corrupt. Is there any sample code available out there? -Robert
0
2399
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile View I want the form populated from there profile on the sql server. The code to save the profile works fine. But when the user logs back in they data doesn't load back to the form. The multiview is located inside the LoginView's Logged-In View ....
1
3544
by: Rusty Hill | last post by:
My site does not allow anonymous users. After a user has logged in and been authenticated I need to access some information in their profile object. I thought I would do this in the LoggedIn event of the Login object but when that event fires the user is still not authenticated so the profile is null. Where and how should I be doing this? Should I be checking the ProfileModule.MigrateAnonymous Event in the global.asax? Remember I do...
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.