epxine
11-16-2011, 11:19 PM
can someone please tell me whats wrong here
<?php
// Make a MySQL Connection
mysql_connect("localhost", "user", "password") or die(mysql_error());
mysql_select_db("cms") or die(mysql_error());
// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM news ORDER BY id")
or die(mysql_error());
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
?>
<div id="post_bg">
<div id="post_txt">
<img src="images/admin_icon.png" width="90px" height="90px" id="post_img">
<a href="#"><?php
echo $row['title'];
}
?></a><br />
<p class="post_text"><font size="-1" face="Times New Roman, Times, serif"><?php
echo $row['content'];
}
?> <br /><br /></p></font>
<label class="post_author"><i>Posted by <a href="#"><?php
echo $row['author'];
}
?></a> <?php
echo $row['date'];
}
?> <a href="#"><?php
echo $row['comments'];
}
?></a></label></i></font>
</div>
</div>
i keep getting syntax error when adding more than 1 echo, i tried only the ['title'] one and it worked but when i started to add content,author,date and comments i get the error.
also the design gets ugly if i add more than 1 news to the database.
<?php
// Make a MySQL Connection
mysql_connect("localhost", "user", "password") or die(mysql_error());
mysql_select_db("cms") or die(mysql_error());
// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM news ORDER BY id")
or die(mysql_error());
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
?>
<div id="post_bg">
<div id="post_txt">
<img src="images/admin_icon.png" width="90px" height="90px" id="post_img">
<a href="#"><?php
echo $row['title'];
}
?></a><br />
<p class="post_text"><font size="-1" face="Times New Roman, Times, serif"><?php
echo $row['content'];
}
?> <br /><br /></p></font>
<label class="post_author"><i>Posted by <a href="#"><?php
echo $row['author'];
}
?></a> <?php
echo $row['date'];
}
?> <a href="#"><?php
echo $row['comments'];
}
?></a></label></i></font>
</div>
</div>
i keep getting syntax error when adding more than 1 echo, i tried only the ['title'] one and it worked but when i started to add content,author,date and comments i get the error.
also the design gets ugly if i add more than 1 news to the database.