Ok so heres the code . The error is this:
$row[title]

$row[content]

$row[date]

$row[title]

$row[content]

$row[date]

$row[title]

$row[content]

$row[date]


i mean thats all i get!
and the code is this

<html>
<head>
<link rel=stylesheet type=text/css href=style.css>
<title>
Blog
</title>
</head>
<body>
<?php
$username = $_SESSION['username'];
include("header.php");
include("dbcon.php");
dbcon();
$result = mysql_query("SELECT * FROM blog
 WHERE username='$username'") or die(mysql_error());  
while ($row = mysql_fetch_array( $result )){
echo "<br>";
echo "<br>";
echo "<center>";
echo "<div class=blog>";
echo "<u><h1>";
echo '$row[title]';
echo "</u></h1>";
echo "<br>";
echo "<br>";
echo '$row[content]';
echo "<br>";
echo "<br>";
echo "<i>";
echo '$row[date]';
echo "</i>";
echo "<br>";
echo "<br>";
echo "</center>";
echo "<div>";
}
?>
</body>
</html>

Recommended Answers

All 5 Replies

don't surround the variables with a '

Ok so heres the code . The error is this:
$row[title]

$row[content]

$row[date]

$row[title]

$row[content]

$row[date]

$row[title]

$row[content]

$row[date]


i mean thats all i get!
and the code is this

<html>
<head>
<link rel=stylesheet type=text/css href=style.css>
<title>
Blog
</title>
</head>
<body>
<?php
$username = $_SESSION['username'];
include("header.php");
include("dbcon.php");
dbcon();
$result = mysql_query("SELECT * FROM blog
 WHERE username='$username'") or die(mysql_error());  
while ($row = mysql_fetch_array( $result )){
echo "<br>";
echo "<br>";
echo "<center>";
echo "<div class=blog>";
echo "<u><h1>";
echo '$row[title]';
echo "</u></h1>";
echo "<br>";
echo "<br>";
echo '$row[content]';
echo "<br>";
echo "<br>";
echo "<i>";
echo '$row[date]';
echo "</i>";
echo "<br>";
echo "<br>";
echo "</center>";
echo "<div>";
}
?>
</body>
</html>

Try to use double quotes instead of a single quotes around
$row[whatever], like this:
echo "$row[title]"; instead of echo '$row[title]';

if does not work, then do this (no quotes at all here:):
echo $row[title];

ok i tried " and without any but they only leave me with a blank screen.

HELP!!

thanks though!

Try this code:
In case of blank screen, it could be either a 500 internal server error, or php is sending error, but error_reporting is off.

<html>
<head>
<link rel=stylesheet type=text/css href=style.css>
<title> Blog </title>
</head>
<body>
<?php
error_reporting(E_ALL);
$username = $_SESSION['username'];
include("header.php");
include("dbcon.php");
dbcon();
$result = mysql_query("SELECT * FROM blog
 WHERE username='$username'") or die(mysql_error());  
while ($row = mysql_fetch_array( $result )){
echo "<br>";
echo "<br>";
echo "<center>";
echo "<div class=blog>";
echo "<u><h1>";
echo $row['title'];
echo "</u></h1>";
echo "<br>";
echo "<br>";
echo $row['content'];
echo "<br>";
echo "<br>";
echo "<i>";
echo $row['date'];
echo "</i>";
echo "<br>";
echo "<br>";
echo "</center>";
echo "<div>";
}
?>
</body>
</html>

erms post contains the answer echo $array['element']; is the correct format
had it been another array $_server everyone would notice the error
everyone has typed echo $_SERVER['php_self'];

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.