Jump to content

Parse error: syntax error, unexpected T_ECHO


Far Cry

Recommended Posts

I am working on this file (index.php).

 

 

CODE:

 

<?php
include_once 'connection.php';

$query = "Select * from news WHERE Page = 1";
$result = mysql_query($query);

while($post = mysql_fetch_array($result)) (
echo "<h1>" . $row['Post_Title'] . "</h1><br>";
echo "<h3>" . $row['Post_Author'] . "</h3><br>";
echo "<p>" . $row['Post_Content'] . "</p>";
)
?>

 

Every time I try to open it up in my browser I get this error:

 

Parse error: syntax error, unexpected T_ECHO in /home/latestne/public_html/index2.php on line 8

 

If you guys can help me fix this error that would be great, thanks in advance

 

<?php
while($post = mysql_fetch_array($result)) (
echo "<h1>" . $row['Post_Title'] . "</h1><br>";
echo "<h3>" . $row['Post_Author'] . "</h3><br>";
echo "<p>" . $row['Post_Content'] . "</p>";
)
?>

 

Should be while() { ... } not while () ( ... )

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.