RevCMS PHP Error

Kristopher

Photographer
Dec 25, 2010
803
68
So I'm trying to have this output:
<p><a class="newsListElement"<a href=" ">News name<br/><i>Posted on:1469230695By:Admin</i></a></p>

Like this:

<p><a class="newsListElement"<a href=" ">News name<br/><i>Posted on: 7/8/2015 By:Admin</i></a></p>

My code is currently:
$result = mysql_query("SELECT title, author, published, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC");

while($news1 = mysql_fetch_array($result))
{
$template->setParams('newsList', '<p><a class="newsListElement"<a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '<br/>' . '<i>Posted on:' . $news1['published'] . 'By:' . $news1['author'] . '</i></a></p> <br>');
}

$news = $engine->fetch_assoc("SELECT title, longstory, author, published FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");
$template->setParams('newsTitle', $news['title']);
$template->setParams('newsContent', $news['longstory']);
$template->setParams('newsAuthor', $news['author']);
$template->setParams('newsDate', date("d-m-y", $news['published']));

unset($result);
unset($news1);
unset($news);

Please note I am trying to stick with the template system. The more help the better as I plan to release a complete different style for RevCMS :)
 

Zodiak

recovering crack addict
Nov 18, 2011
451
413
PHP:
$result = mysql_query("SELECT title, author, published, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC");

while($news1 = mysql_fetch_array($result))
{
$template->setParams('newsList', '<p><a class="newsListElement"<a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '<br/>' . '<i>Posted on:' . date("d-m-y", $news['published']) . 'By:' . $news1['author'] . '</i></a></p> <br>');
}

$news = $engine->fetch_assoc("SELECT title, longstory, author, published FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");
$template->setParams('newsTitle', $news['title']);
$template->setParams('newsContent', $news['longstory']);
$template->setParams('newsAuthor', $news['author']);
$template->setParams('newsDate', date("d-m-y", $news['published']));

unset($result);
unset($news1);
unset($news);
 

Kristopher

Photographer
Dec 25, 2010
803
68
PHP:
$result = mysql_query("SELECT title, author, published, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC");

while($news1 = mysql_fetch_array($result))
{
$template->setParams('newsList', '<p><a class="newsListElement"<a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '<br/>' . '<i>Posted on:' . date("d-m-y", $news['published']) . 'By:' . $news1['author'] . '</i></a></p> <br>');
}

$news = $engine->fetch_assoc("SELECT title, longstory, author, published FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");
$template->setParams('newsTitle', $news['title']);
$template->setParams('newsContent', $news['longstory']);
$template->setParams('newsAuthor', $news['author']);
$template->setParams('newsDate', date("d-m-y", $news['published']));

unset($result);
unset($news1);
unset($news);

It's funny I missed the period... It displays so weird like:

Posted on: 1-1-1970 By: Admin

Not sure what the issue could be. It uses everything rev normally has just editing and trying to learn as I go...
 

Zodiak

recovering crack addict
Nov 18, 2011
451
413
It's funny I missed the period... It displays so weird like:

Posted on: 1-1-1970 By: Admin

Not sure what the issue could be. It uses everything rev normally has just editing and trying to learn as I go...
Would mean it's publishing either an invalid timestamp or a timestamp from 1-1-1970.
 

Kristopher

Photographer
Dec 25, 2010
803
68
I'm gussing it would have to do with:

mysql_query("INSERT INTO cms_news (title,shortstory,longstory,published,image,author, campaign, campaignimg) VALUES ('" . filter($_SESSION["title"]) . "', '" . filter($_SESSION["shortstory"]) . "', '" . ($_SESSION["longstory"]) . "', '" . time() . "', '" . filter($_POST["topstory"]) . "', '" . filter($author) . "', 0, 'default')") or die(mysql_error());

??
 

Users who are viewing this thread

Top