PHP - Mixing Rgb Color Values
Hi,
Assume that I have 50 RGB color values and I want to mix all of them and reach to a final single value which is mixture of all. how can I do that in PHP.
Thanks.
Similar Tutorials
Table Issue - Multiple Location Values For User Pushes Values Out Of Row Instead Of Wrapping In Cell
I have two seperate piece of code. One which sorts description and one which sorts price. However, I am looking to almalgamate them into one. I have tried the following however I appear to be way off. I want to select a product description with one link and then select a price range. However, I want the price range to read the description. <?phpif( isset($_GET['description' ; 'price' ])) $description = $_GET['description' ; 'price']; $query = "SELECT * FROM productfeed WHERE description like '%$description%' LIMIT 0, 10"; $query = "SELECT * FROM productfeed WHERE price like '%$price%' LIMIT 0, 10"; $fetchdata = mysql_query($query) or die("query: $query<br> This has an error: " . mysql_error() . '<br>');while($row = mysql_fetch_array($fetchdata)) { $id = $row['id']; $image = $row['awImage']; $link = $row['link']; $description = $row['description']; $fulldescription = $row['fulldescription']; $price = $row['price']; <?phpif( isset($_GET['description'])) $description = $_GET['description']; $query = "SELECT * FROM productfeed WHERE description like '%$description%' LIMIT 0, 10"; $fetchdata = mysql_query($query) or die("query: $query<br> This has an error: " . mysql_error() . '<br>');while($row = mysql_fetch_array($fetchdata)) { $id = $row['id']; $image = $row['awImage']; $link = $row['link']; $description = $row['description']; $fulldescription = $row['fulldescription']; $price = $row['price']; <?phpif( isset($_GET['price'])) $price = $_GET['price']; $query = "SELECT * FROM productfeed WHERE price like '%$price%' LIMIT 0, 10"; $fetchdata = mysql_query($query) or die("query: $query<br> This has an error: " . mysql_error() . '<br>');while($row = mysql_fetch_array($fetchdata)) { $id = $row['id']; $image = $row['awImage']; $link = $row['link']; $description = $row['description']; $fulldescription = $row['fulldescription']; $price = $row['price']; Hi guys. This is my first post here - so HELLO. I am a very experienced software developer, but new to web work. I am building a software tool using PHP (primarily). As such, many of my questions will concern optimum solutions (in so far as they may be determined), best practices, and the unwritten standards that will surely have evolved through the PHP community over time. My first question concerns the mixing of HTML and PHP. My efforts so far contain a mix, but it doesn't "feel" right. I am using straight XHTML, PHP echo, and also heredoc. I can post the code if folk think it may help. But what is the general view as to whether "mixing" like this is a good and accepted practice, or is another approach preferred? Many thanks in advance for any replies. S Hi im trying to mix php and html in a form however when i do this the whole page disapears and i dont know why the working form is: http://valiantflight.comlu.com/emailer/contact.php <html> <head> <title>Contact Us</title> </head> <body> <fieldset> <legend>Contact Us</legend> <form action="contact.php" method="post"> <input type="hidden" name="frmsubmit"> Your Email:*<br> <input type="text" name="email"><br> Subject:*<br> <select name="subject"> <option value=""></option> <option value="1">Recruitment</option> <option value="2">Absense</option> <option value="3">Enquiry</option> </select> <br> Message:*<br> <textarea name="message" cols="50" rows="5"></textarea> <br> <?php require_once('recaptchalib.php'); $publickey = "6LeB8LwSAAAAAKwvC3HWJNwWw9vYiSEkvFEvDduD"; // you got this from the signup page echo recaptcha_get_html($publickey); ?> <br> <input name"Submit" type="submit" value="Send Email"> </form> Required fields are marked with a *<br><br> <?php if(isset($_POST['frmsubmit'])){ $email = $_POST['email']; $subject = $_POST['subject']; $message = $_POST['message']; //checcking that all relevent information is entered and correct require_once('recaptchalib.php'); $privatekey = "6LeB8LwSAAAAAA_0IIEnAxL5uOau0TBm83Iog7Ey"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if(!$message || !$email || !$subject) { $errmessage ="<font color='red'>The marked areas in the form have not been filled in correctly.</font>"; } if (!$resp->is_valid) { $errmessage ="<font color='red'>The text entered does not match the picture provided.</font>"; } //Sending the email if nothing is wrong if(!$errmessage) { header("location:send.php?subject=".$subject."&email=".$email."&message=".$message.""); }else{ echo $errmessage; } } ?> </fieldset> <br><br><br> </body> </html> and the one that doesnt work is: http://valiantflight.comlu.com/emailer/test/contact.php <html> <head> <title>Contact Us</title> </head> <body> <fieldset> <legend>Contact Us</legend> <form action="contact.php" method="post"> <?php if(isset($_POST['frmsubmit'])){ $email = $_POST['email']; $subject = $_POST['subject']; $message = $_POST['message']; //checcking that all relevent information is entered and correct ?> <input type="hidden" name="frmsubmit"> Your Email:*<br> <input type="text" name="email"> <?php if(!$email) { $errmessage ="<font color='red'>The marked areas in the form have not been filled in correctly.</font>"; echo("<font color='red'><br>Please enter your email.</font>"); } ?> <br> Subject:*<br> <select name="subject"> <option value=""></option> <option value="1">Recruitment</option> <option value="2">Absense</option> <option value="3">Enquiry</option> </select> <?php if(!$subject) { $errmessage ="<font color='red'>The marked areas in the form have not been filled in correctly.</font>"; echo("<font color='red'><br>Please select a subject.</font>"); } ?> <br> Message:*<br> <textarea name="message" cols="50" rows="5"></textarea> <?php if(!$message) { $errmessage ="<font color='red'>The marked areas in the form have not been filled in correctly.</font>"; echo("<font color='red'><br>Please enter a message to send.</font>"); } ?> <br> <?php require_once('recaptchalib.php'); $publickey = "6LeB8LwSAAAAAKwvC3HWJNwWw9vYiSEkvFEvDduD"; // you got this from the signup page echo recaptcha_get_html($publickey); require_once('recaptchalib.php'); $privatekey = "6LeB8LwSAAAAAA_0IIEnAxL5uOau0TBm83Iog7Ey"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $errmessage ="<font color='red'>Some parts of the form have not been entered correctly and have been marked above</font>"; echo("<font color='red'>The text you entered does not match the picture provided.</font>"); } ?> <br> <input name"Submit" type="submit" value="Send Email"> </form> Required fields are marked with a *<br><br> <?php //Sending the email if nothing is wrong if(!$errmessage) { header("location:send.php?subject=".$subject."&email=".$email."&message=".$message.""); }else{ echo $errmessage; } } ?> </fieldset> <br><br><br> </body> </html> If anyone can help it would be really great Thanks, Blink359 Can I somehow mix letters with numbers to create an array with range()? e.g. I want my array for postcode ranges such as array('AB1','AB2', 'AB3', 'AB4', 'AB5', 'Ab6', 'AB7', 'AB8', 'IV5', 'IV6', 'IV7', 'IV8', 'IV9', 'IV10'); I know I can do range(1,8); but was wondering if there was something along the lines of range("AB1", "AB8"); I'm trying to input the results from a query into html, but I'm just getting the variable names rather than their values. I used single quotes for the echo statement, but I think I must need to switch to double to do that. But then I have problems with the double quotes from the class names (ex. class="SideBoxTitle"). Code: [Select] <?php // get user's videos from database $conn = mysqli_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error()); $query = "SELECT * FROM haas12_test.videos"; $result = mysqli_query($conn, $query) or die ("Couldn't execute query."); while($row = mysqli_fetch_assoc($result)) { extract($row); echo ' <div id="topBox" class="mainVideoSideBoxes" > <div class="SideBoxTitle" ><h3> $vidtitle </h3> </div><!-- close SideBoxTitle --> <div class="sideBoxVidContainer"> <div class="SideBoxScreenCast" > $vidurl </div><!-- close SideBoxScreenCast --> <div class="SideBoxDesc" ><p> $viddesc </p> </div><!-- close SideBoxDesc --> </div><!-- close sideBoxVidContainer --> </div><!-- close mainVideoSideBoxes --> </div><!-- close mainVideoSideBoxes --> '; // end echo staement } ?> Hi All, I have the following code which works fine: $mysqli = new mysqli("server", "user", "pass", "database"); if($mysqli->connect_error) { exit('Could not connect'); } $sql = "SELECT customer_contactname, customer_companyname, customer_phonenumber, customer_emailaddress, customer_address1, customer_address2, customer_city, customer_postcode FROM ssm_customer WHERE customer_id = ?"; $stmt = $mysqli->prepare($sql); $stmt->bind_param("s", $_GET['q']); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($ccontname, $ccompname, $cphoneno, $cemail, $cad1, $cad2, $ccity, $cpost); $stmt->fetch(); $stmt->close(); however, when i use my dbconn.php as an include rather than the top section of this code, i get the following error: function prepare() on null The error references the following $stmt = $mysqli->prepare($sql); In my database connection file, i am using the following: $conn = mysqli_connect($db_servername, $db_username, $db_password, $db_name); This seems to be the issue and i believe i am mixing procedural and object based but not sure why there should be a difference here? when i used my database connection file, i do change $mysqli->prepare to $conn->prepare Kind Regards Edited February 4, 2019 by AdamhumbugDear All Members here is my table data.. (4 Columns/1row in mysql table)
id order_no order_date miles How to split(miles) single column into (state, miles) two columns and output like following 5 columns /4rows in mysql using php code.
(5 Columns in mysql table) id order_no order_date state miles 310 001 02-15-2020 MI 108.53 310 001 02-15-2020 Oh 194.57 310 001 02-15-2020 PA 182.22
310 001 02-15-2020 WA 238.57 ------------------my php code -----------
<?php
if(isset($_POST["add"]))
$miles = explode("\r\n", $_POST["miles"]);
$query = $dbh->prepare($sql);
$lastInsertId = $dbh->lastInsertId(); if($query->execute()) {
$sql = "update tis_invoice set flag='1' where order_no=:order_no"; $query->execute();
} ----------------- my form code ------------------
<?php -- Can any one help how to correct my code..present nothing inserted on table
Thank You Edited February 8, 2020 by karthicbabuHi, My company has 240+ locations and as such some users (general managers) cover multiple sites. When I run a query to pull user information, when the user has multiple sites to his or her name, its adds the second / third sites to the next columns, rather than wrapping it inside the same table cell. It also works the opposite way, if a piece of data is missing in the database and is blank, its pull the following columns in. Both cases mess up the table and formatting. I'm extremely new to any kind of programming and maybe this isn't the forum for this question but figured I'd give it a chance since I'm stuck. The HTML/PHP code is below: <table id="datatables-column-search-select-inputs" class="table table-striped" style="width:100%"> <thead> <tr> <th>ID</th> <th>FirstName</th> <th>LastName</th> <th>Username</th> <th>Phone #</th> <th>Location</th> <th>Title</th> <th>Role</th> <th>Actions</th> </tr> </thead> <tbody> <?php //QUERY TO SELECT ALL USERS FROM DATABASE $query = "SELECT * FROM users"; $select_users = mysqli_query($connection,$query);
// SET VARIABLE TO ARRAY FROM QUERY while($row = mysqli_fetch_assoc($select_users)) { $user_id = $row['user_id']; $user_firstname = $row['user_firstname']; $user_lastname = $row['user_lastname']; $username = $row['username']; $user_phone = $row['user_phone']; $user_image = $row['user_image']; $user_title_id = $row['user_title_id']; $user_role_id = $row['user_role_id'];
// POPULATES DATA INTO THE TABLE echo "<tr>"; echo "<td>{$user_id}</td>"; echo "<td>{$user_firstname}</td>"; echo "<td>{$user_lastname}</td>"; echo "<td>{$username}</td>"; echo "<td>{$user_phone}</td>";
//PULL SITE STATUS BASED ON SITE STATUS ID $query = "SELECT * FROM sites WHERE site_manager_id = {$user_id} "; $select_site = mysqli_query($connection, $query); while($row = mysqli_fetch_assoc($select_site)) { $site_name = $row['site_name']; echo "<td>{$site_name}</td>"; } echo "<td>{$user_title_id}</td>"; echo "<td>{$user_role_id}</td>"; echo "<td class='table-action'> <a href='#'><i class='align-middle' data-feather='edit-2'></i></a> <a href='#'><i class='align-middle' data-feather='trash'></i></a> </td>"; //echo "<td><a href='users.php?source=edit_user&p_id={$user_id}'>Edit</a></td>"; echo "</tr>"; } ?>
<tr> <td>ID</td> <td>FirstName</td> <td>LastName</td> <td>Username</td> <td>Phone #</td> <td>Location</td> <td>Title</td> <td>Role</td> <td class="table-action"> <a href="#"><i class="align-middle" data-feather="edit-2"></i></a> <a href="#"><i class="align-middle" data-feather="trash"></i></a> </td> </tr> </tbody> <tfoot> <tr> <th>ID</th> <th>FirstName</th> <th>LastName</th> <th>Username</th> <th>Phone #</th> <th>Location</th> <th>Title</th> <th>Role</th> </tr> </tfoot> </table>
Hi all, Just curious why this works: Code: [Select] while (($data = fgetcsv($handle, 1000, ",")) !== FALSE){ $import="INSERT into $prodtblname ($csvheaders1) values('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]','$data[5]','$data[6]')"; } And this does not: $headdata_1 = "'$data[0]','$data[1]','$data[2]','$data[3]','$data[4]','$data[5]','$data[6]'"; while (($data = fgetcsv($handle, 1000, ",")) !== FALSE){ $import="INSERT into $prodtblname ($csvheaders1) values($headdata_1)"; }it puts $data[#'s] in the database fields instead of the actual data that '$data[0]','$data[1]'... relates to. I wrote a script to create the values in $headdata_1 based on the number of headers in $csvheaders1 but can't seem to get it working in the sql statement. Thanks Hi all, I'm a first time poster here and I would really appreciate some guidance with my latest php challenge! I've spent the entire day googling and reading and to be honest I think I'm really over my head and need the assistance of someone experienced to advise the best way to go! I have a multi dimensional array that looks like (see below); the array is created by CodeIgniter's database library (the rows returned from a select query) but I think this is a generic PHP question as opposed to having anything to do with CI because it related to working with arrays. I'm wondering how I might go about searching the array below for the key problem_id and a value equal to a variable which I would provide. Then, when it finds an array with a the matching key and variable, it outputs the other values in that part of the array too. For example, using the sample data below. How would you recommend that I search the array for all the arrays that have the key problem_id and the value 3 and then have it output the value of the key problem_update_date and the value of the key problem_update_text. Then keep searching to find the next occurrence? Thanks in advance, as above, I've been searching really hard for the answer and believe i'm over my head! Output of print_r($updates); CI_DB_mysql_result Object ( [conn_id] => Resource id #30 [result_id] => Resource id #35 [result_array] => Array ( ) [result_object] => Array ( ) [current_row] => 0 [num_rows] => 5 [row_data] => ) Output of print_r($updates->result_array()); Array ( [0] => Array ( [problem_update_id] => 1 [problem_id] => 3 [problem_update_date] => 2010-10-01 [problem_update_text] => Some details about a paricular issue [problem_update_active] => 1 ) [1] => Array ( [problem_update_id] => 4 [problem_id] => 3 [problem_update_date] => 2010-10-01 [problem_update_text] => Another update about the problem with an ID of 3 [problem_update_active] => 1 ) [2] => Array ( [problem_update_id] => 5 [problem_id] => 4 [problem_update_date] => 2010-10-12 [problem_update_text] => An update about the problem with an ID of four [problem_update_active] => 1 ) [3] => Array ( [problem_update_id] => 6 [problem_id] => 4 [problem_update_date] => 2010-10-12 [problem_update_text] => An update about the problem with an ID of 6 [problem_update_active] => 1 ) [4] => Array ( [problem_update_id] => 7 [problem_id] => 3 [problem_update_date] => 2010-10-12 [problem_update_text] => Some new update about the problem with the ID of 3 [problem_update_active] => 1 ) ) So i have a <drop down> menu, and a <nav> menu on my left side of the page. I have a problem when i click at the first column of my drop down menu and it explores submenu, the submenu mixes with the nav menu that is under the drop down menu on the left. i could solve it with margin-top of the nav menu but i don't like the empty space beetwen them. I tried with putting overflow:visible; in CSS of my dropdown menu but it is still the same. drop down menu is seen but there is stil seen nav menu under and they are mixed. So basicly i want my dropdown menu to be priority, so when i clicks on my first column (only first column is problem because there under is nav menu the other are open nice) it will explore submenu and the part of nav menu that covers the submenu will be hidden.
Here is the screen shot:
Here is the code of head <dropdown> menu if someone finds the problem.
#menu, #menu ul { margin: 0; padding: 0; list-style: none; } #menu { width: 900px; margin-top:20px; margin-left:auto; margin-right:auto; border: 1px solid #222; background-color: #111; background-image: linear-gradient(#444, #111); border-radius: 6px; box-shadow: 0 1px 1px #777; } #menu:before, #menu:after { content: ""; display: table; } #menu:after { clear: both; } #menu { zoom:1; } #menu li { float: left; border-right: 1px solid #222; box-shadow: 1px 0 0 #444; position: relative; } #menu a { float: left; padding: 12px 30px; color: #999; text-transform: uppercase; font: bold 12px Arial, Helvetica; text-decoration: none; text-shadow: 0 1px 0 #000; } #menu li:hover > a { color: #fafafa; } *html #menu li a:hover { /* IE6 only */ color: #fafafa; } #menu ul { margin: 20px 0 0 0; _margin: 0; /*IE6 only*/ opacity: 0; visibility: hidden; position: absolute; top: 38px; left: 0; z-index: 1; background: #444; background: linear-gradient(#444, #111); box-shadow: 0 -1px 0 rgba(255,255,255,.3); border-radius: 3px; transition: all .2s ease-in-out; } #menu li:hover > ul { opacity: 1; visibility: visible; margin: 0; } #menu ul ul { top: 0; left: 150px; margin: 0 0 0 20px; _margin: 0; /*IE6 only*/ box-shadow: -1px 0 0 rgba(255,255,255,.3); } #menu ul li { float: none; display: block; border: 0; _line-height: 0; /*IE6 only*/ box-shadow: 0 1px 0 #111, 0 2px 0 #666; } #menu ul li:last-child { box-shadow: none; } #menu ul a { padding: 10px; width: 130px; _height: 10px; /*IE6 only*/ display: block; white-space: nowrap; float: none; text-transform: none; } #menu ul a:hover { background-color: #0186ba; background-image: linear-gradient(#04acec, #0186ba); } #menu ul li:first-child > a { border-radius: 3px 3px 0 0; } #menu ul li:first-child > a:after { content: ''; position: absolute; left: 40px; top: -6px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #444; } #menu ul ul li:first-child a:after { left: -6px; top: 50%; margin-top: -6px; border-left: 0; border-bottom: 6px solid transparent; border-top: 6px solid transparent; border-right: 6px solid #3b3b3b; } #menu ul li:first-child a:hover:after { border-bottom-color: #04acec; } #menu ul ul li:first-child a:hover:after { border-right-color: #0299d3; border-bottom-color: transparent; } #menu ul li:last-child > a { border-radius: 0 0 3px 3px; }Here is the code of <nav> menu if someone finds the problem. #cssmenu { width:15%; padding: 0; margin-top: 50px; margin-left:auto; margin right:auto; float:left; border: 0; line-height: 1; } #cssmenu ul, #cssmenu ul li, #cssmenu ul ul { list-style: none; margin: 0; padding: 0; } #cssmenu ul { position: relative; z-index: 597; float: left; } #cssmenu ul li { float: left; min-height: 1px; line-height: 1em; vertical-align: middle; position: relative; } #cssmenu ul li.hover, #cssmenu ul li:hover { position: relative; z-index: 599; cursor: default; } #cssmenu ul ul { visibility: hidden; position: absolute; top: 100%; left: 0px; z-index: 598; width: 100%; } #cssmenu ul ul li { float: none; } #cssmenu ul ul ul { top: -2px; right: 0; } #cssmenu ul li:hover > ul { visibility: visible; } #cssmenu ul ul { top: 1px; left: 99%; } #cssmenu ul li { float: none; } #cssmenu ul ul { margin-top: 1px; } #cssmenu ul ul li { font-weight: normal; } /* Custom CSS Styles */ #cssmenu { width: 200px; background: #333333; font-family: 'Oxygen Mono', Tahoma, Arial, sans-serif; zoom: 1; font-size: 12px; } #cssmenu:before { content: ''; display: block; } #cssmenu:after { content: ''; display: table; clear: both; } #cssmenu a { display: block; padding: 15px 20px; color: #ffffff; text-decoration: none; text-transform: uppercase; } #cssmenu > ul { width: 200px; } #cssmenu ul ul { width: 200px; } #cssmenu > ul > li > a { border-right: 4px solid #1b9bff; color: #ffffff; } #cssmenu > ul > li > a:hover { color: #ffffff; } #cssmenu > ul > li.active a { background: #1b9bff; } #cssmenu > ul > li a:hover, #cssmenu > ul > li:hover a { background: #1b9bff; } #cssmenu li { position: relative; } #cssmenu ul li.has-sub > a:after { content: '+'; position: absolute; top: 50%; right: 15px; margin-top: -6px; } #cssmenu ul ul li.first { -webkit-border-radius: 0 3px 0 0; -moz-border-radius: 0 3px 0 0; border-radius: 0 3px 0 0; } #cssmenu ul ul li.last { -webkit-border-radius: 0 0 3px 0; -moz-border-radius: 0 0 3px 0; border-radius: 0 0 3px 0; border-bottom: 0; } #cssmenu ul ul { -webkit-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0; } #cssmenu ul ul { border: 1px solid #0082e7; } #cssmenu ul ul a { font-size: 12px; color: #ffffff; } #cssmenu ul ul a:hover { color: #ffffff; } #cssmenu ul ul li { border-bottom: 1px solid #0082e7; } #cssmenu ul ul li:hover > a { background: #4eb1ff; color: #ffffff; } #cssmenu.align-right > ul > li > a { border-left: 4px solid #1b9bff; border-right: none; } #cssmenu.align-right { float: right; } #cssmenu.align-right li { text-align: right; } #cssmenu.align-right ul li.has-sub > a:before { content: '+'; position: absolute; top: 50%; left: 15px; margin-top: -6px; } #cssmenu.align-right ul li.has-sub > a:after { content: none; } #cssmenu.align-right ul ul { visibility: hidden; position: absolute; top: 0; left: -100%; z-index: 598; width: 100%; } #cssmenu.align-right ul ul li.first { -webkit-border-radius: 3px 0 0 0; -moz-border-radius: 3px 0 0 0; border-radius: 3px 0 0 0; } #cssmenu.align-right ul ul li.last { -webkit-border-radius: 0 0 0 3px; -moz-border-radius: 0 0 0 3px; border-radius: 0 0 0 3px; } #cssmenu.align-right ul ul { -webkit-border-radius: 3px 0 0 3px; -moz-border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px; } Edited by Dorkmind, 26 November 2014 - 05:00 PM. 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> 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, 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> 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'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? 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 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! |