this is about a news poster im making, Im stuck on an error.
this is just the display part.
<?php
$db = mysql_connect("dave90_nl_db", "dave90", "") or die ("Connection to database failed");
mysql_select_db("dave90_nl_db", $db);
$news_SQL = "SELECT * FROM news ORDER BY news_datetime DESC";
$news_result = mysql_query($news_SQL);
?>
<?php
//This part takes care of the message display
while($news = mysql_fetch_array($news_result)) {
?>
<P><br>
<center>
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<font face="arial">
<span style="font-size:12">
Posted on: <?php echo $news['news_datetime'] ?>
</span>
<br>
<span style="font-size:13">
<b><?php echo $news['news_header'] ?></b>
</span>
</font>
</td>
</tr>
<tr>
<td>
<?php
if(strlen($news['news_main']) > 220 {
$news['news_main'] = substr($news['news_main'], 0, 180) . " ... <a href="news.php?news_ID=" . $news['news_ID'] . ">more</a>";
}
?>
<br><font face="arial"><span style="font-size:13"><?php echo $news['news_main'] ?></span></font></td>
</tr>
</table>
</center>
<?php
}
mysql_close();
?>
- <?php
- $db = mysql_connect("dave90_nl_db", "dave90", "") or die ("Connection to database failed");
- mysql_select_db("dave90_nl_db", $db);
- $news_SQL = "SELECT * FROM news ORDER BY news_datetime DESC";
- $news_result = mysql_query($news_SQL);
- ?>
- <?php
- //This part takes care of the message display
- while($news = mysql_fetch_array($news_result)) {
- ?>
- <P><br>
- <center>
- <table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
- <tr>
- <td>
- <font face="arial">
- <span style="font-size:12">
- Posted on: <?php echo $news['news_datetime'] ?>
- </span>
- <br>
- <span style="font-size:13">
- <b><?php echo $news['news_header'] ?></b>
- </span>
- </font>
- </td>
- </tr>
- <tr>
- <td>
- <?php
- if(strlen($news['news_main']) > 220 {
- $news['news_main'] = substr($news['news_main'], 0, 180) . " ... <a href="news.php?news_ID=" . $news['news_ID'] . ">more</a>";
- }
- ?>
- <br><font face="arial"><span style="font-size:13"><?php echo $news['news_main'] ?></span></font></td>
- </tr>
- </table>
- </center>
- <?php
- }
- mysql_close();
- ?>
is giving me an error on the line where if(strlen$news.... starts
its meant to that if the post has more than 220 characters, 180 are displayed, and the rest readable at a link. (set by the id of the post)
without that, just normally
works fine.
the same happening on when i try to change the time format, but ill leave things to this first.
thanks.