PHP output from database
Posted: Sun Nov 08, 2015 5:40 am
[QUOTE=delk1ch;1480607]Hello,
I'm trying to output my database on my website but it's not working, it shows up just a blank page ( IMAGE ), here's the code :
And conn.php is:
I'm trying to output my database on my website but it's not working, it shows up just a blank page ( IMAGE ), here's the code :
Code: Select all
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php
require_once(‘conn.php’);
$sql = ("SELECT * FROM oglasi");
$query = mysql_query($sql);
while ($row = mysql_fetch_array($query)) {
$naziv = $row[‘naziv’];
$sadrzaj = $row[‘sadrzaj’];
echo $naziv;
echo $sadrzaj;
};
?>
</body>
</html>Code: Select all
<?php
$conn = mysql_connect(‘localhost’, ‘root’, ‘ELsk0l@r00t’)
or die (mysql_error());
mysql_select_db(‘elskoglasi’)
or die (‘Database selection incorrect’);
?>