database help

hello I am working with php and mysql for a few weeks now, just trying to update a site. Just have a quick question, I think it is an easy one, btu I jsut cant put a finger on it. I have this code:

Jobs for <?php echo "$month/$day/$year" ?>

<?php // if we have any results, put them into a nice, neat table for viewing if (count ($jobs) > 0) { for ($i = 0; $i < count ($jobs); $i++) { $tmpjob = $jobs[$i]; switch ($tmpjob['job_status']) { case 'New Order': $bgcolor = "#FF3333"; break; case 'In Production': $bgcolor = "#3366FF"; break; case 'Shipped': $bgcolor = "#CCCCCC"; break; case 'Delivered': $bgcolor = "#CCCCCC";[php][/php][php][/php][php] all I want to do is to chanve the "Shipped" into, "Shipping". Everytime I try, it color information gets lost. If anyone has any clue what Ia m talking about, it would be great. thanks [/php]
JOB ID JOB TYPE USERNAME FILE NAME DATE STATUS SPECIAL

It is getting lost because that is the value in the database being compared.

switch ($tmpjob[‘job_status’]) -> means look here and get it’s value
case ‘New Order’: -> if the above variable says exactly this do the stuff below

So for you to change the value from shipped to shipping you have to change the database - either by changing all the shipped values to shipping or by adding the shipping value and entering a new case in your switch.

References:
PHP Switch - http://www.php.net/switch
MySQL Alter - http://dev.mysql.com/doc/mysql/en/ALTER_TABLE.html
MySQL Update - http://dev.mysql.com/doc/mysql/en/UPDATE.html

Sponsor our Newsletter | Privacy Policy | Terms of Service