mysql - select a value from a table with the help of php variable -


i using variable in php code named $user_id. variable takes value after executing short script of code. have table named users in database , table holds user_id , email. if want select email database, when user_id table equal variable named $user_id. can this? query:

<?php  //code ...  $user_id=$_get['user'];    //$user_id gets value here  //now want select email table users, user_id equal variable $user_id  mysql_query(" select `email` `users` `user_id`='$user_id' ");  ?> 

the code should be:

$email = ''; $res = mysqli_query(" select `email` `users` `user_id`='$user_id' ");  while ($temp = mysqli_fetch_assoc($res)) {   $email = $temp['email'];      } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -