php - Can't select user from mysql table. -


i asked question before code submitting users. after few days of guessing, got working. but, now. can't select user inside table login. code.

<?php     if($_post['submit_id'] == 1)     {      //echo $_post['fname'];      $playerf = $_post['fname'];     $playerl = $_post['lname'];     $name = $_post['firstname'];      $link = mysqli_connect("localhost","tester","abc123","biscuit") or die(" did not connect. " . mysqli_error($link));     $query = "select firstname users" or die("did not work." . mysqli_error($link));      if($name != $fname)       {       echo "does not match.";       }      else       {     header ("location: game.php");       }      }    ?>          <table align = "center">       <tr>     <td>        welcome <b> besco's biscuits </b>. please fill out following <br />       areas , begin adventure soon. :)        </td>     </tr>     </table>     <br /> <br /> <br /> <br /> <br />       <table align = "center">       <tr>     <td>          <form action="<?php echo htmlentities($_server['php_self']); ?>" method="post" > <br />         firstname: <input type="text" name="fname" id= "fname" required = "1"> <br />         lastname: <input type = "text" name = "lname" id= "lname" required = "1"> <br />          <input type = "submit" value = "register" id="submit_id" > &nbsp; &nbsp;           <input name="submit_id" type="hidden" id="submit_id" value="1">         <input type = "reset" name="reset" value="reset page" class = "account">        </form>     </td>       </tr>     </table> 

when try submit user identify/match, doesn't , sends me straight game. can help? beta due in 3 days.!!!

you not executing query nor fetching results:

$query = mysqli_query($link, "select firstname users") or die("did not work." . mysqli_error($link)); $user = mysqli_fetch_assoc($link, $query); if($name != $user['firstname']) 

additionally:

  • where did $fname come from? did make up?
  • you don't seem use post variables necessary run query , exact match user. above code return every user check first one. doubt want.
  • you have 2 post variables seem hold first name. correct you?

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -