/    Sign up×
Community /Pin to ProfileBookmark

php output problem

Hello i am having a weird problem can you help me please , my code belov is php , but my problem in it is css , if u have a look i would appreciate it…

[code=php]function lastfivegames($country_id,$team_id)
{

$result=mysql_query(“SELECT home_id AS h, away_id AS a, home_score AS hscr,away_score AS ascr, week_no, country_id
FROM results where
country_id = $country_id and (home_id=$team_id or away_id=$team_id)

“);
echo “<table width=’300′ border=’1′ >”;
$counter=0;
while($row = mysql_fetch_array($result)){
if($counter>4)
{
break;
}
$counter++;
if($row[“hscr”]>$row[“ascr”])
{
$baran2=’relegate’;
$baran1=’chlig’;
}
if($row[“hscr”]<$row[“ascr”])
{
$baran1=’relegate’;
$baran2=’chlig’;
}
if($row[“hscr”]==$row[“ascr”])
{
$baran1=’default’;
$baran2=’default’;

}

echo ‘<tr>’;
echo “<td w&#305;dth=’138′ align=’right’ class=’$baran1′>”;
$home=$row[“h”];
$away=$row[“a”];

$result2=mysql_query(“select name from teams where team_id=$home”);
$row2 = mysql_fetch_array($result2);

echo $row2[“name”];

echo “</td>”;
$result3=mysql_query(“select name from teams where team_id=$away”);
$row3 = mysql_fetch_array($result3);

echo “<td width=’8′>”;
echo $row[“hscr”];
echo “</td>”;

echo “<td width=’8′>”;
echo “-“;
echo “</td>”;

echo “<td width=’8′>”;
echo $row[“ascr”];
echo “</td>”;

echo “<td w&#305;dth=’138′ align=’left’ class=’$baran2′>”;
echo $row3[“name”];
echo “</td>”;

echo “</tr>”;

}
echo”</table>”;
}[/code]

i will try to demonstrate my result with borders :
[COLOR=”Red”]stars do not exist[/COLOR]


—————————————-

|**** Manisa |1|-|0|Besiktas********|
—————————————-


|****Trabzon|1|-|1|Manisa*********|
—————————————-


|**** Manisa|2|-|2|Galatasaray******|
—————————————-

and if i run the same function for an other team the result is


—————————————-

|**********Kasimpasa|0|-|0|Rize****|
—————————————-


|**************Rize|1|-|1|Sivas***|
—————————————-


|*********Fenerbahce|2|-|1|Rize ***|
—————————————-

Obviously i want my results centered like this


—————————————-

| ***** Manisa |1|-|0|Besiktas*******|
—————————————-


|******Trabzon|1|-|1|Manisa********|
—————————————-


|****** Manisa|2|-|2|Galatasaray****|
—————————————-

—————————————-
|****Kasimpasa|0|-|0|Rize**********|
—————————————-


|******** Rize|1|-|1|Sivas*********|
—————————————-


|***Fenerbahce|2|-|1|Rize**********|
—————————————-

Thank you for your help

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@foxbeeflyJul 26.2007 — Take all the alignment tag attributes out of your page.

Add this between your <head> tags (or better: in your style-sheet):

<style>

<!--

td { text-align: center }

-->

</style>
×

Success!

Help @barantamer spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...