You are on page 1of 1

sudo nano /var/www/primer1/index.

php

<?php

// connect to the database

$con = mysql_connect('localhost','pera','peric')

or die('Could not connect to the server!');

// select a database:

mysql_select_db('student') or die('Could not select a database.');

// build query:

$sql = "SELECT ime, prezime, ocena FROM student";

// execute query:

$result = mysql_query($sql) or die('A error occurred: ' . mysql_error());

$count = mysql_num_rows($result);

You might also like