Problem assigning query results to $_SESSION variable (1 Viewer)

cyd44

Registered User.
Local time
Today, 03:29
Joined
Oct 30, 2011
Messages
85
I am a complete novice to php and have a select query wich will return a single row. I want to assign the results of 3 fields within this row to 3 $_SESSION varaiables so that they can be used by another page.

The query code I have at the moment is:-
PHP:
$qry = "SELECT SType1_Desc , SType2_Desc, SType3_Desc FROM patient WHERE UID = '" . $login . "'";
 $result = @mysql_query($qry);

I am trying to asssignTypes 1, 2 & 3 in the qry to $_SESSION['Desc1'] Desc2 & Desc3 variables and then call the session from another page as follows:-
PHP:
<table width="66%" height="50" border="1" align="center" cellpadding="2" cellspacing="1" bordercolor="#000000">
  <!--setting table properties -->
  <td width="18%" align="center">Type</td>
  <td width="82%" align="center">Description</td>
  </tr>
  <tr> 
    <td align="center">Type 1&nbsp</td>
    <td align="center"><?php echo $_SESSION['Desc1'];?>
      <div align="left"> </div></td>   
  </tr>
  <tr> 
    <td align="center">Type 2&nbsp</td>
    <td align="center"><?php echo $_SESSION['Desc2'];?>
      <div align="left"> </div></td>   
  </tr>
  <tr> 
    <td align="center">Type 3&nbsp</td>
    <td align="center"><?php $_SESSION['Desc3'];?>
      <div align="left"> </div></td>   
  </tr>
</table>

I do not get any errors on the php page with the query but am getting errors from the calling page for each Session variable saying
Notice: Undefined index: Desc1 (Desc2 and (Desc3) also.

Could aynone please advise me as I have obviously got something wrong trying to assign the query results
 

Users who are viewing this thread

Back
Top Bottom