PHP - Change Row Color
Hi,
I'm having the following problem. I want to change the row color depending on the value of a record.
i made three different td class in the style.
Then i check the value of the record "TOEGEZEGD" and connect this to $NewClass,
The i try to change the color of the background.
$NewClass takes the value i want (check by display echo $NewClass)
But the background of the row doesn't change, i tried different methodes:
<td class = "$NewClass">'.$row['TOEGEZEGD'].'</td>
<td class = \"$New$Class\">'.$row['VORM'].'</td> <td><DIV CLASS="$NewClass">'.$row['PAKKET'].'</DIV></td> But non of them work please help, it's driving my crazy <?php // checking for started session function is_session_started() { if ( php_sapi_name() !== 'cli' ) { if ( version_compare(phpversion(), '5.4.0', '>=') ) { return session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE; } else { return session_id() === '' ? FALSE : TRUE; } } return FALSE; } if ( is_session_started() === FALSE ) session_start(); if(isset($_SESSION ['ingelogd']) AND $_SESSION['ingelogd'] == 1) {} else { header("location:index.php"); exit; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>**********</title> <meta name="" content=""> </head> <body> <style> textarea, input, button, a, td, span{ font-family: "Trebuchet MS", Helvetica, sans-serif; } td{ color: blue; width: 100px; background-color: #ceffce; height: 50px; text-align: center; } td.JA{ color: red; width: 100px; background-color: #00ee00; height: 50px; text-align: left; } .JA{ color: red; width: 100px; background-color: #00ee00; height: 50px; text-align: left; } td.NEE{ color: green; width: 100px; background-color: #ff0000; height: 50px; text-align: left; } td.MISSCHIEN{ color: orange; width: 100px; background-color: #f07700; height: 50px; text-align: left; } td.op{ color: black; width: 450px; background-color: #ceDDce!important; height: 50px; text-align: left; } th{ color: black; width: 40px; background-color: #cecece; height: 50px; text-align: center; } th.op{ color: black; width: 450px; background-color: #cecece; height: 50px; text-align: center; } .a{ height: 25%; cursor: pointer; } button{ width: 100%; height: 100%; margin: -5 auto -5 auto; } textarea { height: 100%; width: 100%; } .verwijder{ width: 10px; height: auto; background-color: #ffa8a8; } .space{ width: 20px; height: auto; } .invoegen{ background-color: #6dbbdc; width: 1434px; padding: 5px; margin: 5px; } .content{ background-color: #FFDD67; width: 1500px; ; padding: 0 5 0 5; margin: 0 5 0 5; } .content table{ margin-bottom: 100px; } span{ text-decoration: underline; } select{ height: 90%; } </style> <div class="content"> <?php mysql_connect("localhost", "************", "*********") or die(mysql_error()); mysql_select_db("*********"); $sql = "SELECT ID, NAAM, CONTACT, TOEGEZEGD, bestuur1, bestuur2, bestuur3, bestuur4, bestuur5, VORM, PAKKET, KANGEFACTUREERD, GEFACTUREERD, AANTAL, POST, OPMERKING FROM `sponsoren` ORDER BY $field $sort"; $result = mysql_query($sql) or die(mysql_error()); echo'<table>'; while($row = mysql_fetch_array($result)) { $BESTUUR1 = $row['bestuur1']; $BESTUUR2 = $row['bestuur2']; $BESTUUR3 = $row['bestuur3']; $BESTUUR4 = $row['bestuur4']; $BESTUUR5 = $row['bestuur5']; if ($row['TOEGEZEGD'] == 'ja') { $NewClass = "JA" ; } elseif ($row['TOEGEZEGD'] == 'nee') { $NewClass = "NEE"; } elseif ($row['TOEGEZEGD'] == 'misschien') { $NewClass = "MISSCHIEN"; } echo $NewClass; echo'<tr> <td><a href="full_table_row_results.php?ID='.$row['ID'].'">'.$row['ID'].'</a></td> <td>'.$row['NAAM'].'</td> <td>'.$row['CONTACT'].'</td> <td >'; if($BESTUUR1 == 1){ echo "<div class='item'><label>Kk</label></div>"; }; if($BESTUUR2 == 1){ echo "<div class='item'><label>Rutger</label></div>"; }; if($BESTUUR3 == 1){ echo "<div class='item'><label>Toby</label></div>"; }; if($BESTUUR4 == 1){ echo "<div class='item'><label>Meijke</label></div>"; }; if($BESTUUR5 == 1){ echo "<div class='item'><label>Boele</label></div>"; }"</td>"; echo'<td class = "$NewClass">'.$row['TOEGEZEGD'].'</td> <td class = \"$New$Class\">'.$row['VORM'].'</td> <td><DIV CLASS="$NewClass">'.$row['PAKKET'].'</DIV></td> <td>'.$row['KANGEFACTUREERD'].'</td> <td>'.$row['GEFACTUREERD'].'</td> <td>'.$row['AANTAL'].'</td> <td>'.$row['POST'].'</td> <td class = "op">'.$row['OPMERKING'].'</td>'; echo'</tr>'; } echo'</table>'; ?> </div> </body> </html> Similar TutorialsHey, I'm trying to add an class so I can have different background colors on my tabs. This is the nav code for my site Code: [Select] <?php function art_get_menu_auto($theme_location = 'primary-menu', $source='Pages', $Subitems = 'true', $menu = null) { $depth = (!$Subitems ? 1 : 0); if (($source != 'Custom Menu') && function_exists('wp_nav_menu')) { $locations = get_nav_menu_locations(); if ($locations && isset( $locations[ $theme_location ] ) ) { $nav = wp_get_nav_menu_object($locations[$theme_location]); if($nav){ $source = 'Custom Menu'; $menu = $nav; } } } return art_get_menu($source, $depth, $menu); } function art_get_menu($source='Pages', $depth = 0, $menu = null) { if ($source == 'Custom Menu' && function_exists('wp_nav_menu') && $menu) { return art_get_list_menu( array( 'menu' => $menu, 'depth' => $depth)); } if ($source == 'Pages') { return art_get_list_pages(array('depth' => $depth, 'sort_column' => 'menu_order, post_title')); } if ($source == 'Categories') { return art_get_list_categories(array('title_li'=> false, 'depth' => $depth)); } return "Error in menu source ".$source. "."; } /* menus */ function art_get_list_menu($args = array()) { $menu = $args['menu']; $menu_items = wp_get_nav_menu_items($menu->term_id); if(empty($menu_items)) { return sprintf( '<li><a>' .art_option('menu.topItemBegin') .__("Empty menu (%s)", THEME_NS) .art_option('menu.topItemEnd') .'</a></li>', $menu->slug); } $nav_menu = ''; $items = ''; _art_menu_item_classes_by_context($menu_items); $sorted_menu_items = array(); foreach ((array) $menu_items as $key => $menu_item) $sorted_menu_items[$menu_item->menu_order] = wp_setup_nav_menu_item($menu_item); $walker = new art_MenuWalker(); $items .= $walker->walk($sorted_menu_items, 0, array()); $items = apply_filters('wp_nav_menu_items', $items, $args); $items = apply_filters("wp_nav_menu_{$menu->slug}_items", $items, $args); $nav_menu .= $items; $nav_menu = apply_filters('wp_nav_menu', $nav_menu, $args); return $nav_menu; } function _art_menu_item_classes_by_context( &$menu_items ) { global $wp_query; $home_page_id = (int) get_option( 'page_for_posts' ); $queried_object = $wp_query->get_queried_object(); $queried_object_id = (int) $wp_query->queried_object_id; $active_ID = null; $IdToKey = array(); foreach ( (array) $menu_items as $key => $menu_item ) { $IdToKey[$menu_item->ID] = $key; if ( $menu_item->object_id == $queried_object_id && ( ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id ) || ( 'post_type' == $menu_item->type && $wp_query->is_singular ) || ( 'taxonomy' == $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) ) ) ) { $active_ID = $menu_item->ID; } elseif ( 'custom' == $menu_item->object ) { $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url; if ( $item_url == $current_url ) { $active_ID = $menu_item->ID; } } } $currentID = $active_ID; while ($currentID !== null && isset($IdToKey[$currentID])) { $current_item = $menu_items[$IdToKey[$currentID]]; $current_item->classes[] = 'active'; $currentID = $current_item->menu_item_parent; if ($currentID === '0') break; } } class art_MenuWalker extends Walker { var $tree_type = array('post_type', 'taxonomy', 'custom'); var $db_fields = array('parent' => 'menu_item_parent', 'id' => 'db_id'); var $is_active = false; function start_lvl(&$output, $depth) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<ul"; if ($this->is_active){ $output .= ' class="active" '; } $output .= ">\n"; $this->is_active = false; } function end_lvl(&$output, $depth) { $indent = str_repeat("\t", $depth); $output .= "$indent</ul>\n"; } function start_el(&$output, $item, $depth, $args) { global $wp_query; $indent = ($depth) ? str_repeat("\t", $depth) : ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); $active = in_array('active', $classes); $output .= $indent . '<li'; if ($active) { $this->is_active = true; $output .= ' class="active" '; } else { $output .= ' class="1" '; // This line..... } $output .= '>'; $attributes = ! empty($item->attr_title) ? ' title="' . attribute_escape($item->attr_title) .'"' : ''; $attributes .= ! empty($item->target) ? ' target="' . attribute_escape($item->target) .'"' : ''; $attributes .= ! empty($item->xfn) ? ' rel="' . attribute_escape($item->xfn) .'"' : ''; $attributes .= ! empty($item->url) ? ' href="' . attribute_escape($item->url) .'"' : ''; $attributes .= ! empty($class_names) ? ' class="' . attribute_escape($class_names) .'"' : ''; $item_output .= '<a'. $attributes .'>'; if ($depth == 0) $item_output .= art_option('menu.topItemBegin'); $item_output .= apply_filters('the_title', $item->title, $item->ID); if ($depth == 0) $item_output .= art_option('menu.topItemEnd'); $item_output .= '</a>'; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } function end_el(&$output, $item, $depth) { $output .= "</li>\n"; $this->is_active = false; } } /* pages */ function art_get_list_pages($args = array()) { global $wp_query; $pages = &get_pages($args); $IdToKey = array(); $currentID = null; foreach ($pages as $key => $page) { $IdToKey[$page->ID] = $key; } if ($wp_query->is_page) { $currentID = $wp_query->get_queried_object_id(); } $frontID = null; $blogID = null; if ('page' == get_option('show_on_front')) { $frontID = get_option('page_on_front'); if ($frontID && isset($IdToKey[$frontID])) { $frontKey = $IdToKey[$frontID]; $frontPage = $pages[$frontKey]; unset($pages[$frontKey]); $frontPage->post_parent = '0'; $frontPage->menu_order = '0'; array_unshift($pages, $frontPage); $IdToKey = array(); foreach ($pages as $key => $page) { $IdToKey[$page->ID] = $key; } } if (is_home()) { $blogID = get_option('page_for_posts'); if ($blogID && isset($IdToKey[$blogID])) { $currentID = $blogID; } } } $activeIDs = array(); $activeID = $currentID; while($activeID && isset($IdToKey[$activeID])) { $activeIDs[] = $activeID; $activePage = $pages[$IdToKey[$activeID]]; if ($activePage && $activePage->post_status == 'private') { break; } $activeID = $activePage->post_parent; } $result = ''; if (art_option('menu.showHome') && ('page' != get_option('show_on_front') || (!get_option('page_on_front') && !get_option('page_for_posts')))) { $result = '<li><a' . (is_home() ? ' class="active"' : '') . ' href="' . get_option('home') . '">' .art_option('menu.topItemBegin') . art_option('menu.homeCaption') .art_option('menu.topItemEnd') . '</a></li>'; } if (!empty($pages)) { $walker = new art_PageWalker('list', 'ul', $activeIDs, $frontID); $result .= $walker->walk($pages,$args['depth'], array(), $currentID); } return $result; } class art_PageWalker extends Walker { var $db_fields = array('parent' => 'post_parent', 'id' => 'ID'); var $activeIDs = array(); var $frontID = array(); var $is_active = false; function art_PageWalker($type='list', $tag='ul', $activeIDs=array(), $frontID=null){ $this->tag = $tag; $this->activeIDs = $activeIDs; $this->frontID = $frontID; $this->type = $type; } function start_lvl(&$output) { $output .= "\n<".$this->tag; if($this->is_active){ $output .= ' class="active" '; } $output .= ">\n"; $this->is_active = false; } function end_lvl(&$output) { $output .= "</".$this->tag.">\n"; } function start_el(&$output, $page, $depth, $args, $current_page) { $active = in_array($page->ID, $this->activeIDs); $output .= '<li'; if ($active) { $this->is_active = true; $output .= ' class="active" '; } $output .= '><a'; if ($active) { $output .= ' class="active"'; } $href = get_page_link($page->ID); if ($this->frontID && $this->frontID == $page->ID) { $href = get_option('home'); } $title = apply_filters( 'the_title', $page->post_title, $page->ID ); $output .= ' href="'.$href.'" title="'.attribute_escape($title).'">'; if ($depth == 0) $output .= art_option('menu.topItemBegin'); $output .= $title; if ($depth == 0) $output .= art_option('menu.topItemEnd'); $output .= '</a>'; } function end_el(&$output, $page) { $output .= "</li>\n"; $this->is_active = false; } } /* categories */ function art_get_list_categories($args = array()) { global $wp_query; $categories = &get_categories($args); $IdToKey = array(); foreach ($categories as $key => $category){ $IdToKey[$category->term_id] = $key; } $currentID = null; if ($wp_query->is_category) { $currentID = $wp_query->get_queried_object_id(); } $activeID = $currentID; $activeIDs = array(); while ($activeID && isset($IdToKey[$activeID])) { $activeIDs[] = $activeID; $activeCategory = $categories[$IdToKey[$activeID]]; $activeID = $activeCategory->parent; } $result = ''; if (!empty($categories)) { $walker = new art_CategoryWalker('list','ul', $activeIDs); $result .= $walker->walk($categories, $args['depth'], array('count' => false, 'current_category' =>$currentID)); } return $result; } class art_CategoryWalker extends Walker { var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); var $activeIDs = array(); var $is_active = false; function art_CategoryWalker($type='list', $tag='ul', $activeIDs=array()){ $this->tag = $tag; $this->activeIDs = $activeIDs; $this->type = $type; } function start_lvl(&$output){ $output .= "\n<".$this->tag; if ($this->is_active) { $output .= ' class="active" '; } $output .= ">\n"; $this->is_active = false; } function end_lvl(&$output) { $output .= "</".$this->tag.">\n"; } function start_el(&$output, $category, $depth, $args) { $count = intval($category->count); $count_text = sprintf(__('%s posts', THEME_NS), $count); $active = in_array($category->term_id, $this->activeIDs); $output .= '<li'; if ($active) { $this->is_active = true; $output .= ' class="active" '; } $output .= '>'; if ($category->description) { $title = $category->description; } else { $title = $count_text; } $output .= '<a'; if ($active) { $output .= ' class="active"'; } $output .= ' href="'.get_category_link($category->term_id).'" title="'.$title.'">'; if ($depth == 0) $output .= art_option('menu.topItemBegin'); $output .= attribute_escape($category->name); if ($depth == 0) $output .= art_option('menu.topItemEnd'); $output .= '</a>'; } function end_el(&$output, $page) { $output .= "</li>\n"; $this->is_active = false; } } This the line... Code: [Select] $output .= ' class="1" '; // This line..... How could I set the class to the page number - So for example if page 1 then background is blue, if its 5 then its green etc... I want to set up the css but I need to assign the class to the page number.... (Or parent page number if the page number is not top level..) Any ideas? hi all, in my blog (made by me, no wordpress or similar) i would want to change the color of comments written by author of article My code is: $sql = "SELECT author WHERE art_id=..."; //print all comments... while ($row = mysql_fetch_array($result)) { if ($_SESSION['ID_user'] == $sql['ID_user'] ) { $color = "#FFFFFF"; } else { $color = "#FF0000"; } echo '<div id="comment" style="background-color: ' . $color . '">post</div>'; } but the code above print all FFFFFF or all FF0000 Where it is wrong? thanks Hi, I have the following code to change font color from within an IF staement but I can't seem to sort it out. //code if ($server['b']['ip'] == $adminarray1[6] && $server['b']['c_port'] == $adminarray2[6] && $player['name'] == $adminarray3[6]) { $player['name'] = "<font color='blue'>{$server['p'][$key]['name']}</font>"; } //code any help would be greatly appreciated. -Dodge I need a button in php to change my background color every 5 presses with a random one, every five presses the color have to change once and need to stay for the next 5 presses. here is my code <head>
<title>click 5 times</title> Hi, I've making a script that's almost a todo list, and i want to have 3 colors to the posts. Post under 7 days old should be green, and thoose older then 7 days yellow and over 14 days should be red. How could i do that? Every post i timestamp when stored in my MYSQL table. Here is my code: Code: [Select] <?php $servername='localhost'; $dbusername='root'; $dbpassword=''; $dbname='store'; connecttodb($servername,$dbname,$dbusername,$dbpassword); function connecttodb($servername,$dbname,$dbuser,$dbpassword) { global $link; $link=mysql_connect ("$servername","$dbuser","$dbpassword"); if(!$link){die("Could not connect to MySQL");} mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error()); } $result = mysql_query("SELECT * FROM henvendelser ORDER by id desc ") or die(mysql_error()); echo "<table cellspacing='12px' cellpaddomg='5px' align='center'>"; echo "<tr> <th>ID</th> <th> Opprettet </th> <th>Navn</th> <th>Telefon</th> <th>Emne</th> </tr>"; while($row = mysql_fetch_array( $result )) { echo "<tr> <td>"; echo $row['id']; echo "</td> <td>"; echo date("d.m.y", strtotime($row["date"])); echo "</td> <td>"; echo "<a href=\"detaljer.php?view=$row[id]\">$row[Navn]</a>"; echo "</td> <td>"; echo $row['Telefon']; echo "</td> <td>"; echo $row['Emne']; echo "</td> </tr>"; } echo "</table>"; ?> Hi php freaks i am new to php im doin a small project to handle tickets created by customers now i want to change the font color based on the status for example: ID + Name + Product + Status ------------------------------------------------------------------------------------------------------------------------------------ 1111 + abcdef + bat + processing ----------------+--------------------------------------+------------------------------------------+------------------------------ i can connect to database and fetch it the only place i need help is changing the any help would be very helpful thanks in advance Hello everyone! I need a little help to get functions names from the GD library. first i want to say i have a little knowledge with GD library like create image with words and etc. So , what i'm trying to do is to take image and than take the color of the first pixel on the top left than do some function work and than set this pixel on the top left to another color. now , i know how the algorithm should look like , i just don't know what function i need to use to: take specific pixel color from the image set new color for pixel on specific place i'll be glad if you could help me with that , regards , Mor. im trying to get a row color coded by a $var that is pulled from mysql. if $val = yes the <tr> = green else red im only concerned with the table row color atm. the rest of the code is still wip relavent section of code <tr bgcolor= <?php "$bgc"; ?>> // this is were i want the $var placed <td> <?php echo $rows['sku'] ; ?></td> <td> <?php echo $rows['rsku']; ?></td> <td> <?php echo $rows['make']; ?></td> <td> <?php echo $rows['model']; ?></td> <td> <?php echo $rows['comments']; ?></td> <td> <?php echo $rows['sound']; ?></td> <td> <?php echo $rows['gfx']; ?></td> <td> <?php echo $rows['recovery']; ?></td> <td> <?php echo $rows['date']; ?></td> <td> <?php echo $rows['valby']; ?></td> <td width="41" align="center"><a href="update.php?id=<?php echo $rows['id']; ?>">update</a></td> <td width="36" align="center"><a href="delete_ac.php?id=<?php echo $rows['id']; ?>">delete</a></td> </tr> <?php // table bg colour $choice = strtoupper($rows['gfx']); if($choice == "PASS"){ $bgc = "#7FFF00" ; }else{ $bgc = "#8B8989" ; } } ?> full code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Modify DataBase</title> </head> <body> <p align="center"> </p> <table width="400" border="1" align="center"> <tr> <td TD BGCOLOR="#FF9900"> <?php include("config.php"); // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $tbl_name="dsgi_serval"; // Retrieve data from database $search = trim($_POST['search']); if ($search == '' || $search == ' '){ echo "Search Field is Empty - Please Input an SKU Number!"; die; } else{ $sql="select * from $tbl_name WHERE sku LIKE '%$search%'"; $result=mysql_query($sql) or die (mysql_error()); } ?> </td> </tr> </table> <table width="800" height="72" border="1" align="center" cellpadding="3" cellspacing="0"> <tr> <td width="113" align="center"><strong>Orig SKU</strong></td> <td width="66" align="center"><strong>Recon SKU</strong></td> <td width="90" align="center"><strong>Make</strong></td> <td width="169" align="center"><strong>Model</strong></td> <td width="58" align="center"><strong>comments</strong></td> <td width="161" align="center"><strong>Sound</strong></td> <td width="66" align="center"><strong>Graphics</strong></td> <td width="90" align="center"><strong>Recovery</strong></td> <td width="169" align="center"><strong>Date</strong></td> <td width="58" align="center"><strong>Validated By</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr bgcolor= <?php "$bgc"; ?>> <td> <?php echo $rows['sku'] ; ?></td> <td> <?php echo $rows['rsku']; ?></td> <td> <?php echo $rows['make']; ?></td> <td> <?php echo $rows['model']; ?></td> <td> <?php echo $rows['comments']; ?></td> <td> <?php echo $rows['sound']; ?></td> <td> <?php echo $rows['gfx']; ?></td> <td> <?php echo $rows['recovery']; ?></td> <td> <?php echo $rows['date']; ?></td> <td> <?php echo $rows['valby']; ?></td> <td width="41" align="center"><a href="update.php?id=<?php echo $rows['id']; ?>">update</a></td> <td width="36" align="center"><a href="delete_ac.php?id=<?php echo $rows['id']; ?>">delete</a></td> </tr> <?php // table bg colour $choice = strtoupper($rows['gfx']); if($choice == "PASS"){ $bgc = "#7FFF00" ; }else{ $bgc = "#8B8989" ; } } ?> </table> <p> </p> </body> </html> Good day: I'm trying to get the following output to alternate colors of background (white and gray or other colors). Any help will be appreciated. (This is the entire script so far.) <html> <body> <?php $connection = mysql_connect("localhost", "username", "password"); mysql_select_db("articles", $connection); $query="SELECT * FROM articles WHERE id=1"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); ?> <table border="1" cellspacing="2" cellpadding="2"> <tr> <th><font face="Arial, Helvetica, sans-serif">Article</font></th> <th><font face="Arial, Helvetica, sans-serif">Year</font></th> <th><font face="Arial, Helvetica, sans-serif">Description</font></th> <th><font face="Arial, Helvetica, sans-serif">Location</font></th> </tr> <?php $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"article"); $f2=mysql_result($result,$i,"year"); $f3=mysql_result($result,$i,"description"); $f4=mysql_result($result,$i,"location"); $f5=mysql_result($result,$i,"link") ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td> <td ><font face="Arial, Helvetica, sans-serif"><?php echo "<a href=\"$f5\" target=\"_blank\">$f4</a>"; ?></font></td> </tr> <tr> </tr> <?php $i++; } ?> </body> </html> I have a navigation bar that allows the user to change its color. When the color is changed it fades from one color to another. I am trying to make the background do the same. It currently changes color but doesn't have the same fade effect.
Navigation Bar:
var value = $(this).attr('data-color'); $('.navbar').removeClass().addClass('navbar '+ value); return false;Page Background: function colorPink() { document.body.style.backgroundColor = "#FF47D1"; }What can I do to make them both fade? Thanks, Hey Guys! First off, great looking resource, looks like tons of helpful people here. Secondly, I'll upload the file I need help with. Basically I'm looking to change the color of certain words that don't show up well now that I changed the background color.. but there are so many things in this script I can't figure out which one to change. I'm trying to change the words across the top that are in grey, to a lighter color. The site is laughing2myself.com if you need to have a look THANKS! Any help would be greatly appreciated! I am letting users select there color code option for text-shadow for there username I am storing them into a field called "color" HEX exaMPLE: FF6633,AA3633 First is the background color, 2nd is the foreground. (then i'll explode them) Is there a PHP function that let's me validate the input so it's HEX ONLY? I will be db escaping it and intval it too. Hi, I am builing a CMS , where user can choose the colors for menus, body and etc. At present am having a form where users wants to enter the color name. But what i am trying to make a color picker to choose the colors from the palette. How can i integrate the color palattes in my website, and please give me some inputs. Thank you I am trying to learn PHP basics, and I just cant figure out a way to insert color when certain conditions are met. In my code below, I want to print out red color on lets say, odd numbers from 20-49. Appreciate your help big time! <?php for ($i=20; $i<=49; $i++){ echo "$i<br>"; } ?> I wrote a script in ActionScript that takes an image and does color correction, giving me the same results as photoshop's "Auto Color" feature. The actionscript uses an image matrix that looks like this: Code: [Select] var cmf:ColorMatrixFilter = new ColorMatrixFilter(new Array( R, 0, 0, 0, 0, 0, G, 0, 0, 0, 0, 0, B, 0, 0, 0, 0, 0, 1, 0 )); This is different from the php GD's matrix imageconvolution(), which is only 3x3 where the actionscript one is 5x4. I think this is why I am getting different image results. Any suggestions to get the two to act the same? I am stumped... I would like to add a color mixer (not a color selector) on a client's site. It would be like this one: http://www.dur-a-flex.com/Home/ColorPicker Does anyone know where to find a script like this, or if they know a developer who could build it? hey guys!
i'm back again with another question
I've been messing with the piece of code for a few days now and can't get it to function properly.
i'm trying to make each row a different color which works... BUT it leaves out some data and prints it double...
This is the piece of code that will help you find what i've been doing wrong...
$color="1"; while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC)) { if($color==1){ $cardname = $row['Name']; $encodedcardname = str_replace(" ","%20",trim($cardname)); $url = "http://mtgimage.com/card/$encodedcardname.jpg"; echo "<tr bgcolor=''><td>"; echo "<a href=$url>$cardname</a>"; echo "</td><td>"; echo $row['Color']; echo "</td><td>"; echo $row['Type']; echo "</td><td>"; echo $row['Subtype']; echo "</td><td>"; echo $row['Power']; echo "</td><td>"; echo $row['Toughness']; echo "</td><td>"; echo $row['Manacost']; echo "</td><td>"; echo $row['Rarity']; echo "</td><td>"; echo $row['Expansion']; echo "</td><td>"; echo $row['Foil']; echo "</td><td>"; echo $row['Stock']; echo "</td></tr>"; $color="2"; } else { echo "<tr bgcolor='#F8F8F8'><td>"; echo "<a href=$url>$cardname</a>"; echo "</td><td>"; echo $row['Color']; echo "</td><td>"; echo $row['Type']; echo "</td><td>"; echo $row['Subtype']; echo "</td><td>"; echo $row['Power']; echo "</td><td>"; echo $row['Toughness']; echo "</td><td>"; echo $row['Manacost']; echo "</td><td>"; echo $row['Rarity']; echo "</td><td>"; echo $row['Expansion']; echo "</td><td>"; echo $row['Foil']; echo "</td><td>"; echo $row['Stock']; echo "</td></tr>"; $color="1"; } } echo "</table>";A picture of the result of whats it outputting right now is attached to this thread. Thanks in advance! Attached Files Naamloos.png 322.6KB 0 downloads I've got a script that auto-puts watermark on images code: Code: [Select] <?php //get stuff $src = $_SERVER['DOCUMENT_ROOT'].'/'.$_GET['src']; $watermarkSRC = 'img/wm.png'; header('Content-type: image/jpeg'); //create watermark $watermark = imagecreatefrompng($watermarkSRC); //wm dimensions $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); //border $border=25; //some crappy logic if(strpos($src,'.gif') !== false) { $image = imagecreatefromgif($src); } elseif(strpos($src,'.jpeg') !== false || strpos($src,'.jpg') !== false) { $image = imagecreatefromjpeg($src); } elseif(strpos($src,'.png') !== false) { $image = imagecreatefrompng($src); } else { exit("Your image is not a gif, jpeg or png image. Sorry."); } //image dimensions $width=ImageSx($image); $height=ImageSy($image); //lets make a border $img_adj_height=$height+$border; $square=imagecreatetruecolor($width,$img_adj_height); //border + image imagecopyresampled($square, $image, 0, 0, 0, 0, $width, $img_adj_height, $width, $img_adj_height); //watermark placement $dest_x = $width - $watermark_width - 5; $dest_y = $img_adj_height - $watermark_height - 5; //border + watermark imagecolortransparent($watermark,imagecolorat($watermark,0,0)); imagecopyresampled($square, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $watermark_width, $watermark_height); //wrap up imagejpeg($square, "", 100); imagedestroy($image); imagedestroy($watermark); ?> and I want to change it so the watermark will be in a border with the transparent or white background instead of black how can I do that? |