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!!!!!!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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