Как да направа тази система да извежда резултата в няколко р

lqbo123

Registered
Здравйете значи системата ми е за последни теми от форума :

Код:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ANSI" />
</head>
<body>
<?php
$host="localhost";
$user="root";
$pass="1234";
$link=mysql_connect($host, $user, $pass) or die(mysql_error());
$chars="SET CHARACTER SET cp1251";
mysql_query($chars);
$db=mysql_select_db("phpbb3") or die(mysql_error());
$query="SELECT
c.topic_time , c.topic_title,c.forum_id,c.topic_id,
c.topic_replies,c.topic_type FROM phpbb_topics c , phpbb_forums f WHERE
c.forum_id=f.forum_id and f.prune_freq like '0' ORDER BY c.topic_time DESC LIMIT 0,10";
mysql_query("SET NAMES cp1251");
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
if (strlen($row['c.topic_title'])>35)
{$totchki="";}
else
{$totchki="";}

$row['c.topic_title']=substr($tema,0 , 35);
echo "<a href=\"forum/viewtopic.php?t=$row[topic_id]\" title=\"$row[topic_title]\">$row[topic_title]$totchki</a><br>";
}
?>
</body>

Искам да попитам как да го направа да се показва в две редици когато стана много теми да не са само в една колона на долу която върви ами в две колони както съм ви показал на картинката:

1215345D.png
 
Пробвай така
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ANSI" />
</head>
<body>
<?php
$host="localhost";
$user="root";
$pass="1234";
$link=mysql_connect($host, $user, $pass) or die(mysql_error());
$chars="SET CHARACTER SET cp1251";
mysql_query($chars);
$db=mysql_select_db("phpbb3") or die(mysql_error());
$query="SELECT
c.topic_time , c.topic_title,c.forum_id,c.topic_id,
c.topic_replies,c.topic_type FROM phpbb_topics c , phpbb_forums f WHERE
c.forum_id=f.forum_id and f.prune_freq like '0' ORDER BY c.topic_time DESC LIMIT 0,10";
mysql_query("SET NAMES cp1251");
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
if (strlen($row['c.topic_title'])>35)
{$totchki="";}
else
{$totchki="";}

$row['c.topic_title']=substr($tema,0 , 35);
if (!isset($i)) { $i = 0; }
if ($i % 2 == 0) { echo "<br />"; }
echo "<a href=\"forum/viewtopic.php?t=$row[topic_id]\" title=\"$row[topic_title]\">$row[topic_title]$totchki</a><br>"; $i++;
}
?>
</body>
 
пак не става само се подрежда по 2 в една колонка едно под друго но аз искам едното да е от ляво а другото от дясно така може ли да стане ?
 
пробвай така:

Код:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ANSI" />
</head>
<body>
<?php
$host="localhost";
$user="root";
$pass="1234";
$link=mysql_connect($host, $user, $pass) or die(mysql_error());
$chars="SET CHARACTER SET cp1251";
mysql_query($chars);
$db=mysql_select_db("phpbb3") or die(mysql_error());
$query="SELECT
c.topic_time , c.topic_title,c.forum_id,c.topic_id,
c.topic_replies,c.topic_type FROM phpbb_topics c , phpbb_forums f WHERE
c.forum_id=f.forum_id and f.prune_freq like '0' ORDER BY c.topic_time DESC LIMIT 0,10";
mysql_query("SET NAMES cp1251");
$result = mysql_query($query) or die(mysql_error());

echo "<div style=\"float:left; width:300\">";

	while($row = mysql_fetch_array($result)) {
	if (strlen($row['c.topic_title'])>35)
	{$totchki="";}
	else
	{$totchki="";}
	
	$row['c.topic_title']=substr($tema,0 , 35);
	
	
	
				if ($i <= 3 ) { echo "$i  <a href=\"forum/viewtopic.php?t=$row[topic_id]\" title=\"$row[topic_title]\">$row[topic_title]$totchki</a><br/>"; 
					if ($i == 3) { echo "</div><div style=\"float:left; width:300\">";}
				} 
				
				if ($i >= 4  ) { 
					echo "$i <a href=\"forum/viewtopic.php?t=$row[topic_id]\" title=\"$row[topic_title]\">$row[topic_title]$totchki</a><br>";	
				} 
				$i++;
	
	
	
	
	}
echo "</div>";
?>
</body>
 
Пробвай така
while($row = mysql_fetch_array($result)) {
if (strlen($row['c.topic_title'])>35)
{$totchki="";}
else
{$totchki="";}

$row['c.topic_title']=substr($tema,0 , 35);
if ($i == 1) { echo "<p><a href=\"forum/viewtopic.php?t=$row[topic_id]\" title=\"$row[topic_title]\">$row[topic_title]$totchki</a><br>"; }
else if ($i == 21) { echo "</p><p><a href=\"forum/viewtopic.php?t=$row[topic_id]\" title=\"$row[topic_title]\">$row[topic_title]$totchki</a><br>"; }
else if ($i == 40) { echo "<a href=\"forum/viewtopic.php?t=$row[topic_id]\" title=\"$row[topic_title]\">$row[topic_title]$totchki</a><br></p>"; }
else { echo "<a href=\"forum/viewtopic.php?t=$row[topic_id]\" title=\"$row[topic_title]\">$row[topic_title]$totchki</a><br>"; }
$i++;
}
но ще ти трябва и малко CSS
#box { width: 400px; height: auto; }
#box p { float: left; width: 200px; }/quote]
 

Back
Горе