title: username in table1 and password in table 2 in php code
body: <p>I have a username in table1 and password in table 2. What is the syntax to login?</p>
  
  <p>How can I make a login function if I have two tables:</p>
  
  <pre><code>TABLE1 NAME: accounts | COLUMN: acc_id, password, mem_id
  TABLE2 NAME: members  | COLUMN: mem_id, firstname
  </code></pre>
  
  <p>I want to make the "firstname" as $username and make "password" as $password. I have code here, but I can't continue as I don't know whether it's right or not.</p>
  
  <pre><code>$sqlacc="SELECT * FROM members INNER JOIN accounts ON 
  account.acc_id=members.mem_id WHERE members.firstname='$username' and accounts.password='$password'";
  $resultacc = mysql_query($sqlacc);
  $countacc = mysql_num_rows($resultacc);
  $rowacc = mysql_fetch_array($resultacc, MYSQL_NUM);
  
  if($countacc==1){
  $_SESSION['idontknow']=$rowacc[0];
  $_SESSION['idontknow']=$rowacc[1];
  header("location:content/index.php");
  }
  </code></pre>