title: create horizontal bar chart
body: <p>I want to make a horizontal bar chart in a web-page using php,mysql,javascript,css,html and 'wamp server',editor: 'Macromedia Dreamweaver',browser: 'Mozilla Firefox';</p>
  
  <hr>
  
  <p>i want to read data(semister results) from table,and display data through bar chart like,
  <img src="https://i.stack.imgur.com/cuGQZ.png" alt="enter image description here"></p>
  
  <hr>
  
  <ul>
  <li><p><em>Database name</em> <code>exam</code></p></li>
  <li><p><em>Table name</em> <code>'sem_result'</code> contain following columns>> <code>regno[Primary key], uid, reg_date, exam_date, sem, result;</code></p></li>
  </ul>
  
  <hr>
  
  <p>php code is:: <br/> </p>
  
  <pre><code>&lt;?php
  // Connect to server
  $cn=mysql_connect("localhost", "root", "");
  //Connect to Database
  mysql_select_db("exam") or die(mysql_error());
  //sql query
  $sql="SELECT result FROM sem_result WHERE uid=11111";
  //collect results
  $result=mysql_query($sql,$cn);
  //read data if found
  $counter=0;
  while($rd=mysql_fetch_array($result))
  {
   $sem_result[$counter]=$rd[0]; //save sem results into array
   $counter=$counter+1;
  }
  //display
  echo "&lt;table&gt;
  &lt;tr&gt;
      &lt;td&gt;sem1&lt;/td&gt;
      &lt;td width='100px'&gt;
        &lt;img src='img/menu_back.png' width='".$sem_result[0]."%' height='15px'/&gt;
      &lt;/td&gt;
      &lt;td&gt;".$sem_result[0]."%&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;sem2&lt;/td&gt;
      &lt;td width='100px'&gt;
        &lt;img src='img/menu_back.png' width='".$sem_result[1]."%' height='15px'/&gt;
      &lt;/td&gt;
       &lt;td&gt;".$sem_result[1]."&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;";
  //close database
  mysql_close($cn);
   ?&gt;
  </code></pre>
  
  <hr>
  
  <p>if results are 78.95%,78.10%  ,bar chart shows both result are equal, i.e 78%; <br/> image width become 78%,not 78.95% please help to fix this problem.</p>