Jump to content

strange problem!!!only work after a refresh!


joomtalk

Recommended Posts

Hi!!!

i created this code for my chatroom!!

 <?php $usern=$_SESSION['etchat_'.$this->_prefix.'username'];
$con1 = mysql_connect("localhost","manosir_main","***********");
if (!$con1)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("manosir_manoshos_main", $con1);
$query = "SELECT etchat_user_online_user_sex AS gender
          FROM db1_etchat_useronline
          WHERE etchat_user_online_user_name = '$usern'";
$result= mysql_query($query);
$user = mysql_fetch_assoc($result);



if($user['gender']=='m'){ ?> <span style=" font-size: 12px; font-family: tahoma; direction: rtl; font-weight: bold; color: #0000FF " > male</span>
<?php } if($user['gender']=='f'){ ?>  <span style= "font-size: 12px; font-family: tahoma; direction: rtl; font-weight: bold; color: #FF47D1" > female</span><?php }  
mysql_close($con1); ?> 

it gets the users`s username when he login from session and get his/her sex by mysql!!!!!  the starnge part is this:  when i login to page it doesnt work..but when i refresh the page it works :confused: :confused: :confused: :confused: :confused: :confused: :confused:      in first opening the $usern is empty!!  :shrug:

whats wrong!!!!!!!

Archived

This topic is now archived and is closed to further replies.

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