delk1ch Posted November 8, 2015 Share Posted November 8, 2015 Hello, I'm trying to output my database on my website but it's not working, it shows up just a blank page ( http://prntscr.com/90dfbf ), here's the code : <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> And conn.php is: <?php $conn = mysql_connect(‘localhost’, ‘root’, ‘ELsk0l@r00t’) or die (mysql_error()); mysql_select_db(‘elskoglasi’) or die (‘Database selection incorrect’); ?> Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted November 8, 2015 Share Posted November 8, 2015 Instead of actual single quotes, you have some kind of fancy quotes: ‘ should be ' So you'll need to fix your editor. You also need to turn the error messages back on so that PHP will tell you what's wrong: error_reporting display_errors (not to be used in production!) Last but not least, the mysql_* functions are hopelessly outdated and will be removed in PHP 7 (which is released in a few days). Nowadays, we use PDO. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.