php - Select specific username and display something in his profile -


 <?php     if(!isset($_post['searchito'])){ }        $search_sql="select status users id=id";        $search_query=mysql_query($search_sql);     if(mysql_num_rows($search_query)!=null){         $search_rs=mysql_fetch_assoc($search_query); }   if(mysql_num_rows($search_query)!=null){    do{?>     <span>status:&nbsp;</span><?php echo $search_rs['status'];?><br>  <?php       }while($search_rs=mysql_fetch_assoc($search_query)); }  else{     echo "no results found"; } ?> 

this code echo status of registered, want display status of specific user logged in. if user1 has status value of 1 display 1 , user2 has status value of 2 display 2

after few debugging, found solution:

 <?php  $startna = $_session['user_id']; $search_sql="select status users id='$startna'"; $search_query=mysql_query($search_sql);    if(mysql_num_rows($search_query)!=null){    $search_rs=mysql_fetch_assoc($search_query); }   if(mysql_num_rows($search_query)!=null){      do{?> <span>status:&nbsp;</span><?php echo $search_rs['status'];?><br>  <?php        }while($search_rs=mysql_fetch_assoc($search_query)); } else{  echo "no results found"; } ?> 

i add $_session[]; btw answers, helped me lot


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -