title: Pass value from one php file to another php file
body: <p>I create php file for my login.....</p>
  
  <pre><code>&lt;?php
  
  //connect to the db
  
  $host="localhost"; // Host name 
  $user="root"; // Mysql username 
  $pswd=""; // Mysql password 
  $db="gpsvts_geotrack"; // Database name 
  $tbl_name="user_master"; // Table name
  
  $myusername=mysql_real_escape_string($_POST['uname']);
  $mypassword=mysql_real_escape_string($_POST['passwd']);
  
  $conn = mysql_connect($host, $user, $pswd);
  mysql_select_db($db, $conn);
  //run the query to search for the username and password the match
  $query = "SELECT uid FROM "."  ".$tbl_name. "  "."WHERE uname = '$myusername' AND passwd= '$mypassword' ";
  
  $result = mysql_query($query) or die("Unable to verify user because : " . mysql_error());
  //this is where the actual verification happens
  
  if($row = mysql_fetch_assoc($result))
  //echo mysql_result($result,0);  // for correct login response
  {
  echo "User Found";
  
   }
   else  {
      echo "No Such User Found";
  }
  
  
  ?&gt;
  </code></pre>
  
  <p>It is just like this way...So here I select uid. I want get this uid &amp; connect it to another php file. Really I want to get the details of the registered user by mapping so many tables. So I wrote the php file for that also. In the query inside that php file I want to equal the uid I get from above php file to the user_locator_tbl(the table in my database) uid. I did that. But I didn't think its correct. So pls help me.......</p>
  
  <p>I gave here my other php file also....also I'm not fluent php...It is new to me...</p>
  
  <pre><code>&lt;?php
  require_once("dataget.php");
  //connect to the db
  
  $host="localhost"; // Host name 
  $user="root"; // Mysql username 
  $pswd=""; // Mysql password 
  $db="gpsvts_geotrack"; // Database name 
   // Table name
  
  
  
  $conn = mysqli_connect($host,$user,$pswd,$db);
  
  //mysql_select_db($db, $conn);
  //run the query to search for the username and password the match
  //$query = "SELECT * FROM "."  ".$tbl_name. "  "."WHERE uname = '$myusername' AND passwd= '$mypassword' ";
  $query = "select user_master.uid,device_locator_tbl.imei,device_locator_tbl.speed,device_locator_tbl.datetime,device_locator_tbl.number,device_master.icon 
  from device_locator_tbl,device_master,device_registration,user_master where user_master.uid=device_registration.uid
   AND device_registration.imei=device_master.imei AND device_registration.imei=device_locator_tbl.imei AND user_master.uid='$query'";
  //echo ($result);
  
  $resultarray = mysqli_query($conn,$query) or die("Unable to verify user because : " );
  
  //if($row = mysql_fetch_assoc($result))
  
  if($row = mysqli_fetch_assoc($resultarray))
  //echo mysql_result($result,0);  // for correct login response
  {
   $rows[] = $row; 
   }
   // close the database connection
  mysqli_close($conn);
  
  // echo the application data in json format
  echo json_encode($rows);
  ?&gt;
  </code></pre>