title: How to print row number in mysql in PHP application
body: <p>I have a mysql table need to display the data along with the row number in front end aplication. The following query works perfectly in phpMyadmin</p>
  
  <pre><code>SET @row_num=0; SELECT (@row_num:=@row_num+1) AS num,INV,DOS,PTNAME,BAL,PROV     from sheet;
  </code></pre>
  
  <p>But when i use the same code in php projects it is returning the following error
      Warning: mysql_fetch_array(): supplied argument is not a valid MySQL </p>
  
  <p>Below is my code:</p>
  
  <pre><code>&lt;?php 
  $conn = mysql_connect("localhost","root","");
  mysql_select_db("omega",$conn);
  $sel="SET @row_num=0; SELECT (@row_num:=@row_num+1) AS             num,INV,DOS,PTNAME,BAL,PROV from sheet";
  $sqlquery=mysql_query($sel);
  
  while($dis=mysql_fetch_array($sqlquery))
  {
  echo"&lt;tr&gt;";
  echo "&lt;td&gt;".$dis['num']."&lt;/td&gt;";
  echo "&lt;td&gt;".$dis['INV']."&lt;/td&gt;";
  echo "&lt;td&gt;".$dis['DOS']."&lt;/td&gt;";
  echo "&lt;td&gt;".$dis['PTNAME']."&lt;/td&gt;"; 
  echo "&lt;td&gt;".$dis['BAL']."&lt;/td&gt;";    
  echo "&lt;td&gt;".$dis['PROV']."&lt;/td&gt;";       
  echo"&lt;/tr&gt;";
  }
  </code></pre>