to necessitando de ajuda
to querendo fazer o seguinte
to querendo fazer o seguinte
tenho uma tabela
que e conectado ao banco
e quero que apareça em corese diferentes de acordo com o codigo do usuario
por exemplo
eu mando filtrar
e ele me mostra uma tabela com varios chamados de varios clientes
nesta tabela tem cliente 1, 2, 3, e 4
quero que caso for o cliente 1
o estilo da fonte é preto com fundo branco e Times New Roma
caso for o cliente 2
o estilo da fonte é vermelho com fundo amarelo e Arial
caso for o cliente 3
o estilo da fonte é azul com fundo verde e Arial Black
e assim por diante
como que eu faço isso
para conciliar tanto o css, o php, e o sql
help
esta e minha pagina
<?session_start();IF (!(session_is_registered("login"))){ include ("../navcanc.php") ;} ELSE{include ("includes/db.inc.php");include ("includes/gerais.inc.php"); $con = db_conecta(); $str_combo = "select cd_cliente , nm_cliente from cliente"; $rs = mysql_query($str_combo,$con); $num_rows = mysql_num_rows($rs); $aux = mysql_fetch_array($rs);if(!isset($msg)){$msg=1;}if ($msg == 1) {$msg='Chamado incluído com sucesso!';}else if ($msg == 2) {$msg='Erro na inclusão do chamado!';}if ($act == "fechar") { $cd_cliente = $cdc; $str = "update chamado set sg_estado_chamado = 'F', dt_fechamento_chamado = now() where cd_cliente = $cd_cliente and cd_chamado = $cdch"; $result=mysql_query($str,$con); $stra = "select nm_email_usuario from usuario where cd_usuario = $cdu and cd_cliente = $cdc"; $rs = mysql_query($stra); $aux = mysql_fetch_array($rs); # Faz o include do PEAR Mail e do Mime. include ("Mail.php"); include ("Mail/mime.php"); # E-mail de destino. Caso seja mais de um destino, crie um array de e-mails. # *OBRIGATÓRIO* $email[0] = $aux['nm_email_usuario']; $email[1] = $aux['nm_email_usuario2']; $email[2] = $aux['nm_email_usuario3']; # Cabeçalho do e-mail. $headers = array ( 'From' => 'helpdesk@vilainfo.com.br', # O 'From' é *OBRIGATÓRIO*. 'To' => '', 'Subject' => 'Chamado Nº ' . $cdchcli . ' fechado em ' . date("d/m/Y",time()) ); # Define o tipo de final de linha. $crlf = "\r\n"; # Corpo da Mensagem e texto e em HTML $text = 'Chamado Nº ' . $cdchcli . ' fechado em '. date("d/m/Y",time()); $html = "<HTML><BODY><SPAN ID=isee1 STYLE=position:absolute;width:0px;height:0px;top:-5px;visibility:hidden><IMG SRC=http://a0.vilainfo-com-br.hst.isee1.net/ WIDTH=1 HEIGHT=1 BORDER=0></SPAN><b><font color=blue>$text</font><b></BODY></HTML>"; # Instancia a classe Mail_mime $mime = new Mail_mime($crlf); # Coloca o HTML no email $mime->setHTMLBody($html); ## # Anexa um arquivo ao email. ## $mime->addAttachment('/home/suapastahome/www/seuarquivo.txt'); # Procesa todas as informações. $body = $mime->get(); $headers = $mime->headers($headers); # Parâmetros para o SMTP. *OBRIGATÓRIO* $params = array ( 'auth' => true, # Define que o SMTP requer autenticação. 'host' => 'smtp.vilainfo.com.br', # Servidor SMTP 'username' => 'helpdesk=vilainfo.com.br', # Usuário do SMTP 'password' => 'temp' # Senha do seu MailBox. ); # Define o método de envio $mail_object =& Mail::factory('smtp', $params); # Envia o email. Se não ocorrer erro, retorna TRUE caso contrário, retorna um # objeto PEAR_Error. Para ler a mensagem de erro, use o método 'getMessage()'. if ($email[0] != "") { $recipients = $email[0]; # $result = $mail_object->send($recipients, $headers, $body); mail('helpdesk@vilainfo.com.br', 'Chamado Nº ' . $cdchcli . ' fechado em ' . date("d/m/Y",time()), $body); } if ($email[1] != "") { $recipients = $email[1]; # $result = $mail_object->send($recipients, $headers, $body); mail('helpdesk@vilainfo.com.br','Chamado Nº ' . $cdchcli . ' fechado em ' . date("d/m/Y",time()), $body); } if ($email[2] != "") { $recipients = $email[2]; #$result = $mail_object->send($recipients, $headers, $body); mail('helpdesk@vilainfo.com.br', 'Chamado Nº ' . $cdchcli . ' fechado em ' . date("d/m/Y",time()), $body); } if (PEAR::IsError($result)) { echo "ERRO ao tentar enviar o email. (" . $result->getErrorMessage(). ")"; } else { // echo "Email enviado com sucesso!"; } }if ($filtra == "yes") { if ($cb_cliente != 0) { $pos = strpos($cb_cliente,";"); $cod = substr($cb_cliente,0,$pos); $nome = substr($cb_cliente,$pos + 1); $str_aux= " and C.cd_cliente = $cod"; } else { $str_aux= " "; $nome = "TODOS"; } if ($cb_class != 'T') { $str_aux2 = " and C.sg_classifica_chamado = '$cb_class'"; } else { $str_aux2= " "; } $str = "select C.cd_cliente, C.cd_usuario, cd_chamado, cd_chamado_cliente, nm_assunto_chamado, dt_chamado, dt_previsao_chamado, dt_fechamento_chamado, sg_classifica_chamado, U.nm_usuario, C.cd_ip_chamado, C.sg_classifica_chamado, P.nm_projeto from chamado as C, usuario as U, projeto as P where U.cd_usuario = C.cd_usuario_postou and C.cd_projeto = P.cd_projeto and U.cd_cliente = C.cd_cliente_postou ". $str_aux . " and C.dt_chamado >= '". data2date($dt_ini) ."' and C.dt_chamado <= '". data2date($dt_fim) ."' and C.sg_estado_chamado = '$estado' and C.cd_chamado_pai = 0 " . $str_aux2 . " order by dt_chamado desc "; $result = mysql_query($str,$con); if (!($i)) { $i=0; } else { mysql_data_seek($result,$i); } $qt_cham = mysql_num_rows($result); if ($qt_cham == 0) {$qt_cham = "Nenhum Chamado Cadastrado!";} }?><html><head><title> Bem Vindo Administrador :: Chamados :: Helpdesk Vilaris </title><script language="Javascript" src="JS/funcoes.js"></script><style type="text/css"><!--@import url("../css/apresentacao.css");--></style><script language="JavaScript" type="text/JavaScript"><!--function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}//--></script></head><body background="Pictures/fundo_hepdesk_sem_logo.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('Pictures/barra_down/barra_down_r2_c2.gif','Pictures/barra_down/contato.gif','Pictures/barra_down/home.gif','Pictures/barra_down/voltar.gif')"><SPAN ID=isee1 STYLE=position:absolute;width:0px;height:0px;top:-5px;visibility:hidden><IMG SRC=http://a0.vilainfo-com-br.hst.isee1.net/ WIDTH=1 HEIGHT=1 BORDER=0></SPAN><table width="100%" height="100%" border="1" cellpadding="0" cellspacing="0"> <tr valign="top"> <td height="10%"><? include("includes/barra_top.php")?></td> </tr> <tr> <td width="100%" height="80%" valign="top"> <FORM name="filtro" method="post" action="<?=$PHP_SELF?>?filtra=yes" enctype="multipart/form-data"><table width="90%" border="0" align="center"> <tr align="center"> <td colspan="2" class="warning"><?=$msg?></td> </tr> <tr valign="bottom"> <td width="50%"><input class="botao" type="button" size="50" value="MENU DE OPÇÕES" name="logoff2" onClick="location.href('opcoes.php');"></td> <td width="50%"><div align="right"> <input class="botao" type="button" size="50" value="LogOff" name="logoff" onClick="location.href('sessionclose.php');"> </td> </tr></table><table width="90%" border="0" align="center" class=esp> <tr class="table_tit"> <td height="20" align="center" colspan="8" scope="col">FILTRO DE CHAMADOS</td> </tr> <tr > <td width="10%" nowrap class="normal_bold"><div align="right">Dt. Inicial: </div></td> <td width="9%" nowrap class="normal_bold"> <input name="dt_ini" type="text" id="dt_ini" value="<?=date("01/01/Y",time());?>" onKeyPress="return(formataData(this))" size="12" maxlength="10"></td> <td width="8%" nowrap class="normal_bold"><div align="right">Dt. Final:</div></td> <td width="9%" nowrap class="normal_bold"> <input name="dt_fim" type="text" id="dt_fim" value="<?=date("30/12/Y",time());?>" onKeyPress="return(formataData(this))" size="12" maxlength="10"></td> <td width="7%" nowrap class="normal_bold"><div align="right">Estado: </div></td> <td width="12%" nowrap class="normal_bold"><select name="estado" id="estado" > <option value="A">Abertos</option> <option value="F">Fechados</option> </select></td> <td width="9%" nowrap class="normal_bold"><div align="right">Cliente:</div></td> <td width="19%" nowrap class="normal_bold"><span class="normal_bold"> <select name="cb_cliente" > <option value="0 <?=$aux['nm_cliente']?>" selected>Todos</option> <? $i = 1; while ($i <= $num_rows ) { ?> <option value="<?=$aux['cd_cliente'] . ";" . $aux['nm_cliente']?>" > <?=substr($aux['nm_cliente'],0,35)?> </option> <? $aux = mysql_fetch_array($rs); $i++; } $i=0; ?> </select> </span></td> </tr> <tr > <td align="right" nowrap class="normal_bold">Result./Pág.</td> <td align="left" nowrap class="normal_bold"><select name="result_pagina" id="select" > <option value="10">10</option> <option value="20">20</option> <option value="30">30</option> <option value="40">40</option> <option value="50" >50</option> <option value="10000" selected>Ilimitado</option> </select></td> <td align="right" nowrap class="normal_bold">Classificação:</td> <td nowrap class="normal_bold"><select name="cb_class" id="cb_class" > <option value="T">Todos</option> <option value="P">Pendências</option> <option value="S">Solicitações</option> <option value="D">Dúvida</option></option> <option value="N">Não Classificados</option> </select> </td> <td nowrap class="normal_bold"> </td> <td nowrap class="normal_bold"> </td> <td nowrap> </td> <td nowrap><div align="right"> <input class="botao" type="submit" value="Filtrar" name="Submit"> </div></td> </tr></table><br> <? switch ($estado) {case 'F': $est= "FECHADO"; break; case 'A': $est = 'ABERTO'; break; } switch ($cb_class) { case 'T': $nm_class= "TODOS"; break; case 'P': $nm_class= "PENDÊNCIAS"; break; case 'D': $nm_class= "DÚVIDA"; break; case 'N': $nm_class= "NÃO CLASSIFICADOS"; break; case 'S': $nm_class= "SOLICITAÇÕES"; break; } if (!$qt_cham) { ?> <div align=center class="textobold">Preencha os campos e clique em filtrar para executar a pesquisa!</div> <? } else if ($qt_cham == 0) { ?> <div align=center class="warning">Nenhum Chamado <?=$est?> Cadastrado!</div> <? } else { ?> <br> <table width="90%" border="0" align="center"> <tr align="center"> <td width="100%" align="right" class="textobold"><b> <? if (($dt_ini) && ($dt_fim)) { ?>Período: <?=$dt_ini?> a <?=$dt_fim?><? } ?> </b> </td> </tr> </table> <TABLE border=1 align=center class=esp> <TR class="table_tit"> <TD height="20" colSpan=15> <DIV align=center> Chamados <?=$est?>s - Cliente: <?=$nome?> - Classificação: <?=$nm_class?> </DIV> </TD> </TR> <TR align="center" valign="middle"> <TD align="center" class="normal_bold">Cód.</TD> <TD align="center" nowrap class="normal_bold"> Cli.</TD> <TD align="center" class="normal_bold">Assunto</TD> <td align="center" class="normal_bold">Projeto</td> <td class="normal_bold"><div align="center">Classifica</div></td> <TD class="normal_bold" ><div align="center">Dt.Abertura</div></TD> <TD class="normal_bold" ><div align="center">Dt.Previsão</div></TD> <? if ($estado == 'A') { ?> <TD class="normal_bold"><div align="center">Postado </div> </TD> <TD align="center" class="normal_bold">Fec.</TD> <TD align="center" class="normal_bold">Res.</TD> <? } else { ?> <TD align="center" class="normal_bold">Dt.Fechamento </TD> <TD class="normal_bold"><div align="center">Postado </div> </TD> <? } ?> <TD align="center" class="normal_bold">Vis.</TD> <TD align="center" class="normal_bold">Clas</TD> <TD align="center" class="normal_bold">IP</TD> </TR> <? if ($filtra=="yes") { $teste = ($i + $result_pagina); while (( $i < $qt_cham) && ($i < $teste )) { $row = mysql_fetch_array($result);?> <TR> <TD align="center" nowrap ><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"> <?=$row['cd_chamado']?> </a></TD> <TD align="center" nowrap ><div align="center"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"> </a><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"> <?=$row['cd_chamado_cliente']?> </a></div></TD> <TD width="100" align="left" nowrap><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"> <?=substr($row['nm_assunto_chamado'],0,45)?></a></TD> <TD align="left" nowrap><div align="left"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"> <?=$row['nm_projeto']?> </a></div></TD> <TD align="left" nowrap><div align="left"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"> <? switch ($row['sg_classifica_chamado']) { case 'N': $class_temp= "Não Classificado"; break; case 'P': $class_temp= "Pendência"; break; case 'S': $class_temp= "Solicitação"; break; case 'D': $class_temp= "Dúvidas"; break; Case 'T': $class_temp= "Todos"; break; }?> <? echo $class_temp; ?> <? // foi colocado este codigo para facilitar a visualização do nome pos ele vem do banco como codigo. //<?=substr($row['sg_classifica_chamado'],0,18) ?> </a></div></TD> <TD align="center" nowrap><div align="center"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"> <?=date2data(substr($row['dt_chamado'],0,16)); ?><!-- <?=substr($row['dt_chamado'],0,16)?> --> </a></div></TD> <TD align="center" nowrap><div align="center"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"> <?=date2data(substr($row['dt_previsao_chamado'],0,16)); ?><!-- <?=substr($row['dt_chamado'],0,16)?> --> </a></div></TD> <? if ($estado =='A') { ?> <TD align="left" nowrap><div align="left"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"> <?=substr($row['nm_usuario'],0,18)?></a></div></TD> <TD align="center" nowrap> <a href="chamados.php?act=fechar&cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>&filtra=yes&dt_ini=<?=$dt_ini?>&dt_fim=<?=$dt_fim?>&estado=<?=$estado?>&result_pagina=<?=$result_pagina?>&cdchcli=<?=$row['cd_chamado_cliente']?>" onClick='return(confirm("Você tem certeza que deseja fechar o chamado " + <?=$row['cd_chamado']?> + "?"));'> <img src="Pictures/cadeado.bmp" border="0" ></a> </TD> <TD align="center" nowrap> <a href="op_chamado.php?acao=resp&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>&pai=<?=$row['cd_chamado']?>&chcli=<?=$row['cd_chamado_cliente']?>"> <img src="Pictures/edit.gif" width="13" height="15" border="0"></a> </TD> <? } else { ?> <TD align="center" nowrap> <a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"> <?=date2data(substr($row['dt_fechamento_chamado'],0,16))?></a></TD> <TD align="left" nowrap><div align="left"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"> <?=substr($row['nm_usuario'],0,18)?></a></div></TD> <? } ?> <TD align="center" nowrap><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"><img src="Pictures/lupa.gif" width="17" height="16" border="0"></a></TD> <TD align="center" nowrap><a href="#"><img src="Pictures/podium.gif" width="17" height="16" border="0" onClick="window.open('class.php?cdch=<?=$row['cd_chamado']?>','janela',['width=350','height=120','top=200','left=200'])"></a></TD> <TD align="center" nowrap><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"> <?=$row['cd_ip_chamado']?> </a></TD> </TR> <? $i++; } } if ($i > $result_pagina) {?> <a href="<?=$PHP_SELF?>?i=<?=$i - ($result_pagina + 1)?>&filtra=yes&cdc=<?=$cdc?>&cdu=<?=$cdu?>& dt_ini=<?=$dt_ini?>&dt_fim=<?=$dt_fim?>&estado=<?=$estado?>&result_pagina=<?=$result_pagina?>"> <img src="Pictures/prev.gif" border="0"></a> <? } if ($i < $qt_cham) {?> <a href="<?=$PHP_SELF?>?i=<?=$i?>&filtra=yes&cdc=<?=$cdc?>&cdu=<?=$cdu?>& dt_ini=<?=$dt_ini?>&dt_fim=<?=$dt_fim?>&estado=<?=$estado?>&result_pagina=<?=$result_pagina?> "><img src="Pictures/next.gif" border="0"></a> <? }?> <TR class="td_"> <TD height="20" colSpan=15><b>Chamados: <?=$qt_cham?> </b> <DIV align="right"> <input class="botao" type="button" size="50" value="Imprimir Chamados" name="imprime" onClick="window.open('print_chamados.php?dt_ini=<?=$dt_ini?>&dt_fim=<?=$dt_fim?>&estado=<?=$estado?>&cb_cliente=<?=$cb_cliente?>&est=<?=$est?>');"> </DIV> </TD> </TR> </TABLE> <? } ?></FORM > </td> </tr> <tr valign="bottom"> <td height="10%"><? include("includes/barra_down_int.php")?></td> </tr></table></body></html><? mysql_close($con);} ?>