title: printing mysql database in php
body: <p>i have a mysql database name <code>cstudents</code> with table students and <code>sid</code>,<code>sname</code>,<code>sdiv</code> and <code>passyr</code> as the table columns. i intend to print this entire table. here is the code i tried:</p>
  
  <pre><code>$con3=mysql_connect(DB_HOST1,DB_USER1,DB_PASSWORD1) or die ("failed to connect to mysql".mysql_error());
  $db=mysql_select_db(DB_NAME1,$con3) or die ("failed to connect to mysql".mysql_error());
  $query = "SELECT sid, sname, rollno, passyr FROM cstudents.student;
  $result = mysql_query($query) or die ('Error:'.mysql_error($query));
  while ($row = mysql_fetch_assoc($result,mysql_both)) {
      echo $row['sid'];
      echo $row['sname'];
      echo $row['sdiv'];
      echo $row['passyr'];
  }
  </code></pre>
  
  <blockquote>
    <p>executing this gives: Parse error: syntax error, unexpected ''
    (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or
    variable (T_VARIABLE) or number (T_NUM_STRING)</p>
  </blockquote>
  
  <p>please help!</p>