title: MySQL - Discord - Post table/results
body: <p>I have a code that pulls only 1 result and I need it to pull all results (or limit it to 10). Can someone help me out please or point me in the right direction?</p>
  <pre class="lang-js prettyprint-override"><code>con.query(`SELECT * FROM events WHERE closed = 'No'`, (err, rows) =&gt; {
       if (err) throw err;
  
       let sql;
       let eventID = rows[0].eventnumber;
       let hostID = rows[0].host;
       let description = rows[0].eventname;
       let participants = rows[0].participants
  
       const event = `Event ${eventID}: ${description} - Hosted by: &lt;@` + hostID + `&gt;. Participants: ${participants}`
  
       const listEmbed = new Discord.MessageEmbed()
           .setColor('#ff6600')
           .setTitle('Events')
           .setDescription(`${event}`)
  
  
       message.channel.send(listEmbed);
  
       con.query(sql);
   });
  </code></pre>
  <p>The information from the database is as below:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>eventnumber</th>
  <th>host</th>
  <th>eventname</th>
  <th>closed</th>
  <th>participants</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>16</td>
  <td>123456789012345678</td>
  <td>test raid</td>
  <td>Yes</td>
  <td>test0 test1</td>
  </tr>
  <tr>
  <td>17</td>
  <td>123456789012345678</td>
  <td>test raid</td>
  <td>No</td>
  <td>test2 test3 test4</td>
  </tr>
  <tr>
  <td>18</td>
  <td>123456789012345678</td>
  <td>test raid</td>
  <td>No</td>
  <td>test5 test6 test7</td>
  </tr>
  <tr>
  <td>19</td>
  <td>123456789012345678</td>
  <td>test raid</td>
  <td>Yes</td>
  <td>test0 test1</td>
  </tr>
  <tr>
  <td>20</td>
  <td>123456789012345678</td>
  <td>test raid</td>
  <td>No</td>
  <td>test2 test3 test4</td>
  </tr>
  <tr>
  <td>21</td>
  <td>123456789012345678</td>
  <td>test raid</td>
  <td>No</td>
  <td>test5 test6 test7</td>
  </tr>
  <tr>
  <td>22</td>
  <td>123456789012345678</td>
  <td>test raid</td>
  <td>Yes</td>
  <td>test0 test1</td>
  </tr>
  <tr>
  <td>23</td>
  <td>123456789012345678</td>
  <td>test raid</td>
  <td>No</td>
  <td>test2 test3 test4</td>
  </tr>
  <tr>
  <td>24</td>
  <td>123456789012345678</td>
  <td>test raid</td>
  <td>No</td>
  <td>test5 test6 test7</td>
  </tr>
  <tr>
  <td>25</td>
  <td>123456789012345678</td>
  <td>test raid</td>
  <td>Yes</td>
  <td>test0 test1</td>
  </tr>
  <tr>
  <td>26</td>
  <td>123456789012345678</td>
  <td>test raid</td>
  <td>No</td>
  <td>test2 test3 test4</td>
  </tr>
  <tr>
  <td>27</td>
  <td>123456789012345678</td>
  <td>test raid</td>
  <td>No</td>
  <td>test5 test6 test7</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>EDIT:</p>
  <p>So I found a way to make it show 10 events but it looks ugly and I know there is a better way just can't seem to figure it out. Also if there are not 10 results that meet the condition, the code errors out.</p>
  <pre class="lang-js prettyprint-override"><code>    con.query(`SELECT * FROM events WHERE closed = 'No'`, (err, rows) =&gt; {
          if (err) throw err;
  
          let sql;
          let firstID = rows[0].eventnumber;
          let firstHost = rows[0].host;
          let firstDescription = rows[0].eventname;
          let firstParticipants = rows[0].participants;
          let secondID = rows[1].eventnumber;
          let secondHost = rows[1].host;
          let secondDescription = rows[1].eventname;
          let secondParticipants = rows[1].participants;
          let thirdID = rows[2].eventnumber;
          let thirdHost = rows[2].host;
          let thirdDescription = rows[2].eventname;
          let thirdParticipants = rows[2].participants;
          let fourthID = rows[3].eventnumber;
          let fourthHost = rows[3].host;
          let fourthDescription = rows[3].eventname;
          let fourthParticipants = rows[3].participants;
          let fifthID = rows[4].eventnumber;
          let fifthHost = rows[4].host;
          let fifthDescription = rows[4].eventname;
          let fifthParticipants = rows[4].participants;
          let sixthID = rows[5].eventnumber;
          let sixthHost = rows[5].host;
          let sixthDescription = rows[5].eventname;
          let sixthParticipants = rows[5].participants;
          let seventhID = rows[6].eventnumber;
          let seventhHost = rows[6].host;
          let seventhDescription = rows[6].eventname;
          let seventhParticipants = rows[6].participants;
          let eigthID = rows[7].eventnumber;
          let eigthHost = rows[7].host;
          let eigthDescription = rows[7].eventname;
          let eigthParticipants = rows[7].participants;
          let ninethID = rows[8].eventnumber;
          let ninethHost = rows[8].host;
          let ninethDescription = rows[8].eventname;
          let ninethParticipants = rows[8].participants;
          let tenthID = rows[9].eventnumber;
          let tenthHost = rows[9].host;
          let tenthDescription = rows[9].eventname;
          let tenthParticipants = rows[9].participants;
  
          const firstEvent = `**Event ${firstID}:** ${firstDescription}\n**Hosted by:** &lt;@` + firstHost + `&gt;\n**Participants:** ${firstParticipants}`
          const secondEvent = `**Event ${secondID}:** ${secondDescription}\n**Hosted by:** &lt;@` + secondHost + `&gt;\n**Participants:** ${secondParticipants}`
          const thirdEvent = `**Event ${thirdID}:** ${thirdDescription}\n**Hosted by:** &lt;@` + thirdHost + `&gt;\n**Participants:** ${thirdParticipants}`
          const fourthEvent = `**Event ${fourthID}:** ${fourthDescription}\n**Hosted by:** &lt;@` + fourthHost + `&gt;\n**Participants:** ${fourthParticipants}`
          const fifthEvent = `**Event ${fifthID}:** ${fifthDescription}\n**Hosted by:** &lt;@` + fifthHost + `&gt;\n**Participants:** ${fifthParticipants}`
          const sixthEvent = `**Event ${sixthID}:** ${sixthDescription}\n**Hosted by:** &lt;@` + sixthHost + `&gt;\n**Participants:** ${sixthParticipants}`
          const seventhEvent = `**Event ${seventhID}:** ${seventhDescription}\n**Hosted by:** &lt;@` + seventhHost + `&gt;\n**Participants:** ${seventhParticipants}`
          const eigthEvent = `**Event ${eigthID}:** ${eigthDescription}\n**Hosted by:** &lt;@` + eigthHost + `&gt;\n**Participants:** ${eigthParticipants}`
          const ninethEvent = `**Event ${ninethID}:** ${ninethDescription}\n**Hosted by:** &lt;@` + ninethHost + `&gt;\n**Participants:** ${ninethParticipants}`
          const tenthEvent = `**Event ${tenthID}:** ${tenthDescription}\n**Hosted by:** &lt;@` + tenthHost + `&gt;\n**Participants:** ${tenthParticipants}`
  
          const listEmbed = new Discord.MessageEmbed()
              .setColor('#ff6600')
              .setTitle('Events')
              .setDescription(`${firstEvent}\n\n${secondEvent}\n\n${thirdEvent}\n\n${fourthEvent}\n\n${fifthEvent}\n\n${sixthEvent}\n\n${seventhEvent}\n\n${eigthEvent}\n\n${ninethEvent}\n\n${tenthEvent}`)
  
  
          message.channel.send(listEmbed);
  
          con.query(sql);
      });
  </code></pre>
  <p>I really would appreciate the help.</p>
  <p>Thanks.</p>