Código PHP:
<?php
if(isset($_GET['campo']) and isset($_GET['orden'])){
$campo=$_GET['campo'];
$orden=$_GET['orden'];
}else{
//por defecto
$campo='cod_certificado';
$orden='ASC';
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_rs_basedate20142 = "cod_certificado";
$colname_rs_basedate2014 = "cadena_vacia____";
if (isset($_GET['lst_criterio'])) {
$colname_rs_basedate20142 = $_GET['lst_criterio'];
}
if (isset($_GET['txt_cadena'])) {
$colname_rs_basedate2014 = trim($_GET['txt_cadena']);
if (empty($colname_rs_certificados)){
$colname_rs_certificados = "cadena_vacia____";
}
}
mysql_select_db($database_con_safelive, $con_safelive);
$query_rs_basedate2014 = sprintf("SELECT cod_certificado, nom_participantes, nom_empresa, nom_curso, tipo_cert, fecha_emision, estado FROM basedate2014 WHERE $colname_rs_basedate20142 like %s ORDER BY $campo $orden",GetSQLValueString("%".$colname_rs_basedate2014."%","text"));
$rs_basedate2014 = mysql_query($query_rs_basedate2014, $con_safelive) or die(mysql_error());
//$row_rs_certificados = mysql_fetch_assoc($rs_certificados);
$totalRows_rs_basedate2014 = mysql_num_rows($rs_basedate2014);
//echo $query_rs_certificados;
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8" />
<title>111111111</title>
<META NAME="description" CONTENT="aaaaaaaa">
<link rel="shortcut icon" type="image/x-icon" href="css/images/favicon.ico" />
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<link rel="stylesheet" href="css/flexslider.css" type="text/css" media="all" />
<script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
<!--[if lt IE 9]>
<script src="js/modernizr.custom.js"></script>
<![endif]-->
<script src="js/jquery.flexslider-min.js" type="text/javascript"></script>
<script src="js/functions.js" type="text/javascript"></script>
<link rel="stylesheet" href="certi/css/tema1.css" type="text/css" />
<link rel="shortcut icon" type="image/x-icon" href="jr.ico" />
</head>
<script>
var datos=new Array();
function uno(src,color_entrada) { src.bgColor=color_entrada;src.style.cursor="hand"; }
function dos(src,color_default) { src.bgColor=color_default;src.style.cursor="default"; }
//aqui recuperamos los datos de la ventana padre
function RecuperaDatos(form){
form.txt_cadena.focus();
}
function LimpiaForm(form){
form.txt_cadena.value="";
form.txt_cadena.focus();
}
function buscar(form) {
form.submit();
}
function iSubmitEnter(oEvento, oFormulario){
var iAscii;
if (oEvento.keyCode)
iAscii = oEvento.keyCode;
else if (oEvento.which)
iAscii = oEvento.which;
else
return false;
if (iAscii == 13) buscar(oFormulario);
return true;
}
</script>
<body>
<body id="page4" onLoad="RecuperaDatos(frmbuscar);>
<!-- wrapper -->
<div id="wrapper">
<!-- header -->
<header class="header">
<div class="shell">
<h1 id="logo"><a href="index.html"></a></h1>
<!-- navigation -->
<nav id="navigation">
<ul>
<li >
<a href="index.html">Inicio</a>
<span></span>
</li>
<li>
<a href="quienessomos.html">Quienes Somos</a>
<span></span>
</li>
<li>
<a href="servicios.html">Servicios</a>
<span></span>
</li>
<li>
<a href="contacto.html">Contáctenos</a>
<span></span>
</li>
</ul>
<div class="cl"> </div>
</nav>
<!-- end of navigation -->
</div>
</header>
<!-- end of header -->
<!-- slider-holder -->
<div class="slider-holder1">
<!-- shell -->
<div class="certificados">
<p>
<form method="GET" name="frmbuscar" id="frmbuscar" action="certificados.php">
<div class="indent-left4" align="center">
<li><h4 class="p2" align="center"><strong>CERTIFICADOS EMITIDOS</strong></h4></li>
<label>
Buscar por:
</label>
<label>
<select name="lst_criterio">
<option value="cod_certificado">Codigo certificado</option>
<option value="nom_participantes">Participantes</option>
</select>
<input name="txt_cadena" onKeyPress="iSubmitEnter(event, document.frmbuscar)" />
</label>
<td style="text-align: center"><input name="Submit" type="button" class="error" onClick="buscar(frmbuscar)" value="Consultar">
<input name="btn_limpia" type="reset" class="error" onClick="LimpiaForm(frmbuscar)" id="btn_limpia" value="Limpiar"></td>
</div>
<p></p>
<p><br>
</p>
</form>
<table width="100%" align="center" border="1" class="adminmenu">
<tr class="color-3">
<th><div align="center">Código de Certificado</div></th>
<th width="200"><div align="center">Participante</div></th>
<th width="200"><div align="center">Empresa</div></th>
<th><div align="center">Curso</div></th>
<th><div align="center">Tipo de Certificación </div></th>
<th><div align="center">Fecha de Emision</div></th>
<th><div align="center">Estado</div></th>
</tr>
<?php $secuencia=0;
while ($row_rs_basedate2014 = mysql_fetch_assoc($rs_basedate2014))
{ $secuencia++;
?>
<tr align="center">
<tr onMouseOver="uno(this,'949596');" onMouseOut="dos(this,'ffffff');" align="center" >
<td valign="middle" ><?php echo $row_rs_basedate2014['cod_certificado']; ?></td>
<td width="200"><?php echo $row_rs_basedate2014['nom_participantes']; ?></td>
<td width="200"><?php echo $row_rs_basedate2014['nom_empresa']; ?></td>
<td><?php echo $row_rs_basedate2014['nom_curso']; ?></td>
<td><?php echo $row_rs_basedate2014['tipo_cert']; ?></td>
<td><?php echo $row_rs_basedate2014['fecha_emision']; ?></td>
<?php
if($row_rs_basedate2014["estado"]=="EXPIRADO")
{
$color="red";
}
else
{
$color="green";
}
?>
<td >
<font color="<?php echo $color; ?>"> <?php echo
$row_rs_basedate2014["estado"]; ?> </font>
</td>
<?php
}
if($secuencia==0){
?>
<tr onMouseOver="uno(this,'cccccc');" onMouseOut="dos(this,'FFFFFF');" >
<td colspan="11"><div align="center">No hay resultados que mostrar
</div></td>
</tr>
<?php
}
?>
</table></p>
</div>
<!-- end of slider-holder -->
<!-- main -->
<div class="main"></div>
<!-- end of main -->
</div>
<!-- end of shell -->
</div>
<!-- wrapper -->
<!-- footer -->
<div id="footer">
<div class="shell">
<!-- footer-cols -->
<section class="footer-cols">
<div class="col">
<h3><strong>IMPORTANTE:</strong></h3>
<p>
</span>LOS CERTIFICADOS EMITIDOS EN EL<span style="text-align: justify"> 2012 Y/O CERTIFICADOS VENCIDOS SERAN BORRADOS AUTOMATICAMENTE DE NUESTRA BASE DE DATOS</span>.
<td style="text-align: center"><p>
</p>
<p> </p></td>
</div>
<div class="col">
<h3>SIGUENOS EN:</h3>
<table width="152" border="0">
<tr>
<td width="103"><p><img src="css/images/fb.png" width="20" height="20" alt=""/><a href="#" style="color: #FFFFFF"> FACEBOOK</a></p></td>
<td width="39"></td>
</tr>
<tr>
<td> <p><img src="css/images/twter.png" width="20" height="20" alt=""/><a href="#" style="color: #FFFFFF"> TWITTER</a></p></td>
<td> </td>
</tr>
</table>
</div>
<div class="col contact">
<h3>CONTÁCTENOS<strong>:</strong></h3>
<p>FONO: (44) 272816 - (44) 655190 </p>
<p>RPM: #963521800 - #996620060 </p>
<p> RPC: 951307243 - 949072298
</p>
<a href="#"></a>
</div>
<div class="cl"> </div>
</section>
<!-- end of footer-cols -->
<p class="copy">© </a></p>
<div class="cl"> </div>
</div>
</div>
<!-- end of footer -->
<script type="text/javascript"> Cufon.now(); </script>
</body>
</html>
ESTE ES EL CODIGO...