title: View SQL table on HTML page(SQL SERVER MANAGEMENT STUDIO)
body: <p>I am creating a website that will be connected with the database. I have created a database in SQL Server. </p>
  
  <p>I want to connect one table with one html page, so that I can view the table on that page. In this way I will connect all the SQL tables with each html page.</p>
  
  <p>I know I have to use php/javaquery!</p>
  
  <p>Please help me with appropriate codes!</p>
  
  <p>Also I am new to SQL. I am learning! </p>
  
  <p>Please explain the changes that I will have to do in the codes you provide to enable it in my system.</p>
  
  <p>i got these 2 codes:which will work for my requirement?
   code1:
               
  
  <pre><code>  $result = mysqli_query($con,"SELECT * FROM Orders");
  
   echo "&lt;table&gt;";
   echo "&lt;table border='1'&gt;
   &lt;tr&gt;
   &lt;th&gt;ID&lt;/th&gt;
   &lt;th&gt;orderNumber&lt;/th&gt;
   &lt;th&gt;Price&lt;/th&gt;
   &lt;th&gt;customerName&lt;/th&gt;
   &lt;th&gt;salesRep&lt;/th&gt;
   &lt;th&gt;DatePicker&lt;/th&gt;
   &lt;th&gt;shipMethod&lt;/th&gt;
   &lt;th&gt;trackingNumber&lt;/th&gt;
   &lt;th&gt;Statuscheck&lt;/th&gt;
   &lt;th&gt;Edit&lt;/th&gt;
   &lt;/tr&gt;";
  
   while($row = mysqli_fetch_array($result))
     {
  echo "&lt;tr&gt;";
  echo "&lt;td&gt;" . $row['ID'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['orderNumber'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['Price'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['customerName'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['salesRep'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['DatePicker'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['shipMethod'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['trackingNumber'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['Statuscheck'] . "&lt;/td&gt;";
  echo "&lt;td&gt;" . $row['Edit'] . "&lt;/td&gt;";
  echo "&lt;/tr&gt;";
    }
  echo "&lt;/table&gt;";
  
  ?&gt;
  </code></pre>
  
  <p>
     </p>
  
  <p>code2:</p>
  
  <pre><code> &lt;?php
  
     $host=""; // Host name 
     $username=""; // Mysql username 
     $password=""; // Mysql password 
     $db_name=""; // Database name 
     $tbl_name=""; // Table name 
  
    // Connect to server and select databse.
       mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
       mysql_select_db("$db_name")or die("cannot select DB");
       $sql="SELECT * FROM $tbl_name ORDER BY id DESC";
    // OREDER BY id DESC is order result by descending
    }
        $result=mysql_query($sql);
  
      ?&gt;
  
    &lt;html&gt;
  
    &lt;head&gt;
  
     &lt;script type="text/javascript" charset="utf-8" src="jquery.js"&gt;&lt;/script&gt;
  
    &lt;/head&gt;
  
     &lt;table id="forum" width="90%" border="0" align="center"          cellpadding="3"      cellspacing="1" bgcolor="#CCCCCC"&gt;
  
   &lt;thead&gt;
  
    &lt;tr&gt;
     &lt;th width="6%" align="center" bgcolor="#E6E6E6"&gt;&lt;strong&gt;#&lt;/strong&gt;&lt;/td&gt;
      &lt;th width="43%" align="center" bgcolor="#E6E6E6"&gt;&lt;strong&gt;Topic&lt;/strong&gt;&lt;/td&gt;
     &lt;th width="10%" align="center" bgcolor="#E6E6E6"&gt;&lt;strong&gt;Author&lt;/strong&gt;&lt;/td&gt;
     &lt;th width="15%" align="center" bgcolor="#E6E6E6"&gt;&lt;strong&gt;Views&lt;/strong&gt;&lt;/td&gt;
      &lt;th width="13%" align="center" bgcolor="#E6E6E6"&gt;&lt;strong&gt;Replies&lt;/strong&gt;&lt;/td&gt;
       &lt;th width="13%" align="center"  bgcolor="#E6E6E6"&gt;&lt;strong&gt;Date/Time&lt;/strong&gt;&lt;/td&gt;
  
       &lt;/tr&gt;
  
      &lt;/thead&gt;
  
      &lt;?php 
    // Start looping table row
   while($rows=mysql_fetch_array($result)){
       ?&gt;
  
    &lt;tbody&gt;
  
    &lt;tr&gt;
    &lt;td bgcolor="#FFFFFF"&gt;&lt;? echo $rows['threadtype']; ?&gt;&lt;/td&gt;
    &lt;td bgcolor="#FFFFFF"&gt;&lt;a href="view_topic.php?id=&lt;? echo $rows['id']; ?&gt;"&gt;
    &lt;? echo $rows['topic']; ?&gt;&lt;/a&gt;&lt;BR&gt;&lt;/td&gt;
   &lt;td align="center" bgcolor="#FFFFFF"&gt;&lt;? echo $rows['email']; ?&gt;&lt;/td&gt;
    &lt;td align="center" bgcolor="#FFFFFF"&gt;&lt;? echo $rows['view']; ?&gt;&lt;/td&gt;
     &lt;td align="center" bgcolor="#FFFFFF"&gt;&lt;? echo $rows['reply']; ?&gt;&lt;/td&gt;
     &lt;td align="center" bgcolor="#FFFFFF"&gt;&lt;? echo $rows['datetime']; ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;/tbody&gt;
  
     &lt;?php
  
     // Exit looping and close connection 
    }
     mysql_close();
  
    ?&gt;
  
   &lt;tfoot&gt;
   &lt;tr&gt;
   &lt;td colspan="6" align="right" bgcolor="#E6E6E6"&gt;&lt;strong&gt;Create New  Topic&lt;/strong&gt; td&gt;
  &lt;/tr&gt;
    &lt;/tfoot&gt;
  &lt;/table&gt;
  
   &lt;/html&gt;
  </code></pre>