Hello!
How can PHP output some information from the database to a page?
For example:
<div class="main"> <h1>Статьи</h1><br> <?php $connect = mysql_connect('localhost','root','12345'); mysql_select_db('algoritm_db',$connect); $sql="select * from articles"; $result=mysql_query($sql)or die("Query failed: " . mysql_error()); $i=0; while($row = mysql_fetch_array($result, MYSQL_NUM)) { print "<div class='zaglav'>".$row[1]."</div>"; $i=$i+1; } ?> </div> Ie I wanted to create several div blocks of the same class, but with different info .. but it does not work, displays the PHP code and everything .... Displays after print ...
What am I doing wrong?
Thank.