Jump to content

joomtalk

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

joomtalk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi i said!!this code execute after loginpage..inside the chatting page ..... i will try and change the lace and will use it as a function!!!i will say the result!!!!!!
  2. it works after login!!! when user login and redirected to the chat page!!! this is the page but i suppose u wont understand anything! manos.ir
  3. 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: in first opening the $usern is empty!! whats wrong!!!!!!!
  4. please!!somebody helps....is it still unreadable???? :shrug: :shrug:
  5. hi! what is unreadable??? let me say it again! i want to get the gender of the user who is seeing the page... as u see i get the username from the session! in this line $usern=$_SESSION['etchat_'.$this->_prefix.'username']; then i am going to connect to database and find the gender of this username $usern so i used this code: $users= mysql_query(" select etchat_user_online_user_sex from db1_etchat_useronline where etchat_user_online_user_name = $usern "); the problem is: i dont know how to echo the result... the reslut will be m(male) or f(female) or n(unknown) in other projects i used to echo the result with mysql_fetch_array..but in this one i dfont know how can i do this! i attached my db table!!! thanx!!!!
  6. Hi everybody i am beginnet with working with sql in php..so i confused.....i made one scripte and i am making the secound and now i am facing a problem....i hope u could help!! i have a dat=abse of my chatroom....this is the code i typed...please have a look at it! $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); $users= mysql_query(" select etchat_user_online_user_sex from db1_etchat_useronline where etchat_user_online_user_name = $usern "); in my database, i ahve a table called db1_etchat_useronline that keeps record of online users in chatroom. as u usee i qant to to get the user sex ( etchat_user_online_user_sex) of th current user!!! as u see i conected to database correctly but now i dont know how to echo the $users . before this i echo my sql results with mysql_fetch_array ..but now i cant.......i got nothing!!!! can someone help me!!!!! :confused:
×
×
  • 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.