Jump to content

Problemas com a noticia


Recommended Posts

Estou tentando inserir no meu site as noticias do WHMCS através do codigo:

<?php
include("/dbconnect.php");
include("/includes/functions.php");
$query = "SELECT * FROM tblannouncements WHERE
published='on' ORDER BY date DESC LIMIT 0,3";
$result = mysql_query($query);
while ($data = mysql_fetch_array($result)) {
$id = $data["id"];
$date = $data["date"];
$title = $data["title"];
$announcement = $data["announcement"];
$date = fromMySQLDate($date);
echo("<p><font color=#cccccc>$date</font> - <b>$title</b><br>$announcement</p>");
}
?>[/HTML]

Ao inseri-lo no site, não aparece as noticias e sim aparece um quadrado com :

[PHP]$date - $title
$announcement

"); } ?> [/PHP]

Alguem teria como me ajudar?

Link to comment
Share on other sites

Já tentou escapar as variáveis?


[COLOR=#000080]<?php include("/dbconnect.php"); include("/includes/functions.php"); $query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC LIMIT 0,3"; $result = mysql_query($query); while ($data = mysql_fetch_array($result)) { $id = $data["id"]; $date = $data["date"]; $title = $data["title"]; $announcement = $data["announcement"]; $date = fromMySQLDate($date); echo"<p><font color=#cccccc>".$date."</font> - <b>".$title."</b><br>".$announcement."</p>"; } ?>[/COLOR]

Link to comment
Share on other sites

isso mesmo voce tem que concatenar as variaveis com a string.

Ex:

$var1 = "P";
$var2 = "D";
$var3 = "H";

$tudo = "Este é o forum do " . $var1 . $var2 . $var3;

echo $tudo;[/PHP]

Resultado:

Este é o forum do PDH

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Do you agree with our terms?