View difference between Paste ID: GpAhUhga and hsHdR4bS
SHOW: | | - or go back to the newest paste.
1
<?php
2
//konekcija do database
3
$db_host = "localhost"; //obicno je localhost
4
$db_username = "root";  //username za bazu
5
$db_pass = "123456";  //password za bazu
6
$db_name = "gamersbaza"; //ime baze
7
8
9
mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
10
mysql_select_db("$db_name") or die ("no database");             
11
12
?>
13
<?php 
14-
           $rezultat=mysql_fetch_array(mysql_query("SELECT * FROM users"));
14+
           $row=mysql_fetch_array(mysql_query("SELECT * FROM igre ORDER BY id"));
15
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16-
           $rusername = $rezultat["username"]; // Ispis podataka
16+
$id = $row["id"]; // Ispis podataka
17
$ime_igre= $row["ime_igre"]; // Ispis podataka
18
$link_igre = $row["link_igre"]; // Ispis podataka
19
20
mysql_free_result($query); 
21
mysql_close();
22
23
?>
24
25
26
<?php
27
echo "<table border='1'> 
28
<tr> 
29
<th> ID </th>
30
<th> Ime Igre </th> 
31
<th> Link Igre </th> 
32
</tr>"; 
33
34
echo "<tr>"; 
35
echo "<td>" . $row['id'] . "</td>"; 
36
echo "<td>" . $row['ime_igre'] . "</td>"; 
37
echo "<td>" . $row['link_igre'] . "</td>"; 
38
echo "</tr>"; 
39
echo "</table>"; 
40
?>