PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<table border"1"><?php
$db = mysql_connect("localhost", "Gappa", " ");
mysql_select_db("Gappa",$db);
$date_formats = array('d/m/y', 'd/m/Y', 'd/m/Y H:i:s', 'D d-M-y', 'D d-M-Y', 'D d-M-Y H:i:s', 'l d F Y', 'l d F Y H:i:s');
$query = 'SELECT topic_title, FROM_UNIXTIME(topic_time,"%W the %D of %M %r") AS Topic_Date, post_text, username FROM phpbb_topics RIGHT JOIN phpbb_posts_text ON topic_first_post_id=post_id RIGHT JOIN phpbb_users ON topic_poster=user_id WHERE forum_id=6 ORDER BY topic_time DESC';
$result = mysql_query($query, $db) or die ($query .': '.mysql_error());
while($row = mysql_fetch_assoc($result))
{
echo $row['topic_title'];
echo " posted by ";
echo $row['username'];
echo " at ";
echo $row['topic_time'], '<br/>';
echo $row ['post_text'];
}
?></table>
Ok.. so got rid of some of the pointless code i think... still getting errors.
Parse error: parse error, unexpected T_STRING in /data/hosted/Gappa/test3.php on line 1
Also, it would be good to tell us which line is line 11, because with the text wrapping and all, I was at first thinking while($row = mysql_fetch_assoc($result)) was line 11.
P.S. Use the PHP button, it's there for a reason. =)
<table border"1"><?php
$db = mysql_connect("localhost", "Gappa", "xocunino");
mysql_select_db("Gappa",$db);
$date_formats = array('d/m/y', 'd/m/Y', 'd/m/Y H:i:s', 'D d-M-y', 'D d-M-Y', 'D d-M-Y H:i:s', 'l d F Y', 'l d F Y H:i:s');
$query = 'SELECT topic_title, FROM_UNIXTIME(topic_time,"%W the %D of %M %r") AS Topic_Date, post_text, username FROM phpbb_topics RIGHT JOIN phpbb_posts_text ON topic_first_post_id=post_id RIGHT JOIN phpbb_users ON topic_poster=user_id WHERE forum_id=6 ORDER BY topic_time DESC';
$result = mysql_query($query, $db) or die ($query .': '.mysql_error());
while($row = mysql_fetch_assoc($result))
{
echo "$row[topic_title] posted by $row[username] at $row[topic_time] <br/> $row[post_text]";
}
?></table>
Now i been fulling around with adding html tags like ><b><FONT FACE=Arial SIZE=-1 COLOR=#FF9900
> but I dont know where to add them, everytime I do add them it changes my out put to just give me topic_title and nothing else...
Sooo was wondering how do I add such tags... just to make everything look pretty
<HTML>
<table border"1"><?php
$db = mysql_connect("localhost", "Gappa", " ");
mysql_select_db("Gappa",$db);
$date_formats = array('d/m/y', 'd/m/Y', 'd/m/Y H:i:s', 'D d-M-y', 'D d-M-Y', 'D d-M-Y H:i:s', 'l d F Y', 'l d F Y H:i:s');
$query = 'SELECT topic_title, FROM_UNIXTIME(topic_time,"%W the %D of %M %r") AS Topic_Date, post_text, username FROM phpbb_topics RIGHT JOIN phpbb_posts_text ON topic_first_post_id=post_id RIGHT JOIN phpbb_users ON topic_poster=user_id WHERE forum_id=6 ORDER BY topic_time DESC';
$result = mysql_query($query, $db) or die ($query .': '.mysql_error());
while($row = mysql_fetch_assoc($result))
{
echo "<b><FONT FACE=Arial SIZE=-1 COLOR=#FF9900>";
echo "$row[topic_title]</b>";
echo "<FONT SIZE=-2 COLOR=#666666 posted by $row[username]";
echo " at $row[topic_time]<br/>";
echo "<FONT SIZE=-1 COLOR=#FFFFFF $row[post_text]";
echo "<br/><br/>";
}
?></table>
</HTML>
OK think this is right... but its not working.. still only displaying the topic_title and nothing else.
<html>
<head>
</head>
<body>
<?php
$db = mysql_connect("localhost", "Gappa", "xocunino");
mysql_select_db("Gappa",$db);
$date_formats = array('d/m/y', 'd/m/Y', 'd/m/Y H:i:s', 'D d-M-y', 'D d-M-Y', 'D d-M-Y H:i:s', 'l d F Y', 'l d F Y H:i:s');
$query = 'SELECT topic_title, FROM_UNIXTIME(topic_time,"%W the %D of %M %r") AS Topic_Date, post_text, username FROM phpbb_topics RIGHT JOIN phpbb_posts_text ON topic_first_post_id=post_id RIGHT JOIN phpbb_users ON topic_poster=user_id WHERE forum_id=6 ORDER BY topic_time DESC';
$result = mysql_query($query, $db) or die ($query .': '.mysql_error());
while($row = mysql_fetch_assoc($result))
{
echo "<b><FONT FACE=Arial SIZE=-1 COLOR=#FF9900>";
echo "$row[topic_title]</FONT></b>";
echo "<FONT SIZE=-2 COLOR=#666666> posted by $row[username]";
echo " at $row[topic_time]</FONT><br/>";
echo "<FONT FACE=Arail SIZE=-1 COLOR=#000000> $row[post_text]</FONT>";
echo "<br/><br/>"; }
?>
</body>
</html>
Hehe styles nice man, but i'll work on that after i get a baisc layout to work... this in general is working apart from the topic_time is no longer working! eeeekkk!!! any suggestions!?
You need to escape those double quotes in the HTML otherwise PHP thinks you've ended the string and then put a bunch of random characters it doesn't understand after it - you can see the difference in the syntax colouring of the code you posted and this below: