title: MySQL Joining Player Info with Times
body: <p>I'm using this query to return all profile info of a player and also all of the times associated with that player from the EVENT_DATA table. However, I'm only being returned one event time per player even though each player has more than one time in the database. The player's name is being used in a search box, and that's why the WHERE clause includes the name entered into the search. Does anyone recommend that I run two separate queries; one for the profile and one for the times? The profile data comes up ok, but it's just the event data only being limited to one row. This is my code, and I appreciate any suggestions. </p>
  
  <pre><code>     &lt;form class='form-inline quick-search-form' role='form'&gt;
          &lt;div class='form-group'&gt;
                  &lt;input type='text' id='name' name='name' class='form-control' placeholder='Driver name'&gt;
          &lt;/div&gt;
          &lt;button type='submit' id='quick-search' class='btn btn-custom'&gt;&lt;span class='glyphicon glyphicon-search custom-glyph-color'&gt;&lt;/span&gt;&lt;/button&gt;
        &lt;/form&gt;
  
  
  
  
  $sql = "SELECT EVENT_DATA.personaId, EVENT_DATA.ID AS event_id, EVENT_DATA.alternateEventDurationInMilliseconds, EVENT_DATA.EVENTID, EVENT_DATA.rank, EVENT_DATA.carId, PERSONA.iconIndex, PERSONA.cash, PERSONA.level, PERSONA.created, PERSONA.score, PERSONA.motto, PERSONA.repAtCurrentLevel, PERSONA.rep, PERSONA.name AS p_name
  FROM EVENT_DATA
  INNER JOIN PERSONA ON EVENT_DATA.personaId = PERSONA.ID
  
  
  WHERE (PERSONA.name = '".@mysqli_real_escape_string($conn, $_GET['name'])."' AND EVENT_DATA.EVENTID = '43' AND EVENT_DATA.alternateEventDurationInMilliseconds &gt; '0')";
  
  
  if ($result = mysqli_query($conn, $sql)){
  
      if(mysqli_num_rows($result) &gt; 0)  { 
  
         while ($row = mysqli_fetch_array($result)){
  
  
  $name = $row['p_name'];
  $avatarimg = mysqli_real_escape_string($conn, $row['iconIndex']);
  $cash = mysqli_real_escape_string($conn, $row['cash']);
  $name = mysqli_real_escape_string($conn, $row['p_name']);
  $level = mysqli_real_escape_string($conn, $row['level']);
  $createddate = mysqli_real_escape_string($conn, $row['created']);
  $driverscore = mysqli_real_escape_string($conn, $row['score']);
  $motto = mysqli_real_escape_string($conn, $row['motto']);
  $repcurrent = mysqli_real_escape_string($conn, $row['repAtCurrentLevel']);
  $reptotal = mysqli_real_escape_string($conn, $row['rep']);
  $personaid = $row['personaId'];
  $eventid = $row['EVENTID'];
  $milliseconds = $row['alternateEventDurationInMilliseconds'];
  </code></pre>
  
  <p>Then, I used php echo for each of the variables, and outputted them in a table.</p>
  
  <p>Thank you!</p>