2
I have the following query:
$select = "SELECT concat(mid(cpf,1,3),'.',mid(cpf,4,3),'.',mid(cpf,7,3),'-',mid(cpf,10,2)) as cpf, nome, genero, nome_cracha, rg, crm, crm_uf, rua, bairro, cep, cidade,
estado, telefone, celular, fax, email, cna, ano_titulo_especialista, categoria_inscricao,
forma_pagamento, dataconfirmacao, data from inscricao order by nome ASC";
and I want the variable $x to know the value "categoria_registration" (which the query will show). This is what I want to do:
if($x == "valor de categoria_inscricao" ){
...
}
Edited
I’m using a code to convert table values to Excel. But I want instead of appearing the column value, I can show that if the column value is "x" what will appear in Excel is "y".
Follows the code:
<?php
if (!isset($_SESSION)) session_start();
if (!isset($_SESSION['usuario'])) {
session_destroy();
header("Location: index.php"); exit;
}
include("conexao.php");
$select = "SELECT concat(mid(cpf,1,3),'.',mid(cpf,4,3),'.',mid(cpf,7,3),'-',mid(cpf,10,2)) as cpf, nome, genero, nome_cracha, rg, crm, crm_uf, rua, bairro, cep, cidade,
estado, telefone, celular, fax, email, cna, ano_titulo_especialista, categoria_inscricao,
forma_pagamento, dataconfirmacao, data from inscricao order by nome ASC";
$export = mysql_query($select) or die ("Sql error : ".mysql_error());
$fields = mysql_num_fields($export);
$header = "";
$data = "";
for ( $i = 0; $i<$fields; $i++ )
{
$header .= mysql_field_name($export, $i)."\t";
}
while( $row = mysql_fetch_row( $export ) )
{
$line = '';
foreach( $row as $value )
{
if ((!isset($value)) || ($value == ""))
{
$value = "\t";
}
else
{
$value = str_replace( '"' , '""' , $value );
$value = '"'.$value.'"'."\t";
}
$line .= $value;
}
$data .= trim( $line ) . "\n";
}
$data = str_replace( "\r" , "" , $data );
if ( $data == "" )
{
$data = "\n(0) Records Found!\n";
}
$novonome = date('Ymd');
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=".$novonome.".xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$header\n$data";
?>
aeee ... that ae man ...haha vlw!
– Ursones