Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Silly task...Changing Text colour

Codes here !

Moderators: macek, egami, gesf

Postby elitecodex » Thu Jul 11, 2002 5:40 pm

If you are trying to change the color of a link, dont use the font tag unless you are attempting to provide maxium compatibility for older browsers. (NOTE: This is just my opinion)
Use something like the following:
Code: Select all
echo "<a href=\"whatever.php\" style=\"color: #ffffff;\">Link Text</a>";


This is using CSS to change the color of the font. You can also check out http://www.w3schools.com/css/css_reference.asp for more specific information.

The way that you are doing it, you would have to use an attribute in the <font> tag to change the text color. Not 100% sure on how to do that, but none-the-less, I would recommend the CSS

Will
elitecodex
New php-forum User
New php-forum User
 
Posts: 68
Joined: Tue Jul 09, 2002 8:45 am
Location: East Coast, USA

Re: Silly task...Changing Text colour

Postby WiZARD » Thu Jul 11, 2002 10:54 pm

findit wrote:Hi There

This is driving me around the twist, it is a simple task yet it will not except it.
<?




if ($Category != "") {

$query = "SELECT * FROM Downloads ";
if ($Category != 0) {
$query .= "WHERE Category=" . $Category;
}

$rst = mysql_query($query, $con);
if (!$rst) {
echo mysql_error();
mysql_close($con);
exit;
}

if (mysql_num_rows($rst) == 0 ) {
echo "<TD colspan="4"font size="2" text="#FFFFFF"><FONT FACE=ARIAL SIZE=2>No items in category</FONT></TD></TEXT>";
} else {

$MAXPAGES = mysql_num_rows($rst);
for($i=0;$i<($CurrentPage-1) * $DOWNLOADS_PER_PAGE; $i++) {

if (!$row = mysql_fetch_row($rst)) {
exit;
}

}

$i=0;
while (($row = mysql_fetch_row($rst)) && $i<10) {
$i++;
echo "<TR>\n";
echo "\t\t<TD><FONT FACE=ARIAL SIZE=2><A HREF="sendfile.php3?Product=" . $row[4] . "&DownloadID=" . $row[0];
if ($row[7] != "")
{
echo "&redirect=" . $row[7];
}
echo "">" . $row[1] . "</A></FONT></TD>\n";
echo "\t\t<TD><FONT FACE=ARIAL SIZE=2>" . $row[2] . "</FONT></TD>\n";
echo "\t\t<TD><FONT FACE=ARIAL SIZE=2>" . $row[3] . "</FONT></TD>\n";
echo "\t\t<TD><FONT FACE=ARIAL SIZE=2>" . $row[5] . "</FONT></TD>\n";
echo "\t</TR>\n";
}

}

}

mysql_close($con);

?>
</TABLE>
<HR>
<font color="#FFFFFF">
<?

if ($CurrentPage == 1) {
if (($CurrentPage * $DOWNLOADS_PER_PAGE) > $MAXPAGES) {
echo "<FONT FACE=ARIAL SIZE=2><b>| Previous Page | Next Page |</b></FONT>";
} else {
echo "<FONT FACE=ARIAL SIZE=2><b>| Previous Page | </b><A HREF="downloads.php3?Category=$Category&CurrentPage=2"><b>Next Page</b></A> |</FONT>";
}
} elseif ($CurrentPage > 1) {

if (($CurrentPage * $DOWNLOADS_PER_PAGE) > $MAXPAGES) {
echo "<FONT FACE=ARIAL SIZE=2>| <A HREF="downloads.php3?Category=$Category&CurrentPage=" .($CurrentPage -1) . "">Previous Page</A><b> | Next Page |</b></FONT>";
} else {
echo "<FONT FACE=ARIAL SIZE=2>| <A HREF="downloads.php3?Category=$Category&CurrentPage=" .($CurrentPage -1) . "">Previous Page</A> | <A HREF="downloads.php3?Category=$Category&CurrentPage=" . ($CurrentPage+1) . "">Next Page</A> |</FONT>";
}
}
?>

all I want to do is change the echo text (No items in category) to the colour White as I have a dark background, I have tried everything.
I have had no problem changing anything else in the coding.

look forward to any reply

Richard


Hi there!
Interesting how it's work?
Code: Select all
if ($Category != "") {

$query = "SELECT * FROM Downloads ";
if ($Category != 0) {
$query .= "WHERE Category=" . $Category;
}


if your variiable $Category != "" and $Category != 0 not as same?
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby Oleg Butuzov » Fri Jul 12, 2002 7:39 am

2WiZARD

Man, it is not same!

If var is empty them it will be true

Code: Select all
if ($emptyvar == null)
if ($emptyvar == "")
if (!$emptyvar)


2elitecodex
Yea man CSS is COOL!

2findit
USE IT!

or

your code

Code: Select all
echo "<TD colspan=\"4\"font size=\"2\" text=\"#FFFFFF\"><FONT FACE=ARIAL SIZE=2>No items in category</FONT></TD></TEXT>";


my code

Code: Select all
echo ("<TD colspan=4><FONT FACE=ARIAL SIZE=2 color=#000000>No items in category</FONT></TD></TEXT>");


regards...
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron