I'm trying to make my php page working, by having html code combined with it. Here is a source code:
<?
$username="username";
$password="password";
$db_name="db_name";
mysql_connect('localhost',$username,$password) or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$userstable='profile';
$query = "SELECT * FROM $userstable order by id";
$result = mysql_query($query) or die(mysql_error());
?>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DayZSC | Showlist</title>
<meta charset="utf-8" />
<link type="text/css" rel="stylesheet" href="styles.css" />
<link rel="shortcut icon" href="favicon.ico" />
</head>
<body>
<div class="container">
<div id="logo">
<img src="img/logo.png" />
</div>
<?
while ($row=mysql_fetch_array($result)) {
?>
<div class='p_content'>
<h3>
<?
echo ".$row['name'].";
?>
</h3>
<p style="text-align: justify;">
<table align="center"><tbody><tr>
<td>Copies Sold (Week)</td>
<td>11152</td>
</tr>
<tr>
<td>Copies pirated (Week)</td>
<td>124214</td>
</tr>
</tbody></table>
</p>
<h2><a href="#">Comments</a></h2><br /><br />
</div>
<?
}
?>
<div id="footer">All rights reserved © 2014 | Designed by <a href="http://berdyevcreations.com" target="_blank" style="color: #000;">BerdyevCreations</a></div>
</div>
</body>
</html>
So whenever I try to run this page, it gives me just a blank. Cannot find error log either. Please help?
I think you are using the PHP short tags wring, try and use this:
<?= $row['name'] ?>
Instead of your
<?
echo ".$row['name'].";
?
I think your problems is with php tags
, you are curently using short ones while your php is probably not configured to accept them so change short tags
<?
To long tags
<?php
You need to activate the short code directive in PHP.INI
if you have php version 5.3 and earlier
since 5.4 This directive is enabled by default
like this php.ini
short_open_tag=On