Ver Mensaje Individual
  #2 (permalink)  
Antiguo 19/08/2008, 10:56
aliyuwey
 
Fecha de Ingreso: mayo-2008
Mensajes: 148
Antigüedad: 16 años
Puntos: 1
Respuesta: ayuda con encuestador

Bueno después de buscar en varios sitios logre hacer una hoja q me diera los resultados, ahora estoy buscado la forma de hacer que me aparezca al lado de cada resultado el porcentaje que representa cada uno, aquí les dejo el código Porcia les sirve a alguno, y ojala puedan ayudarme a resolver el tema de los porcentajes

Cita:
<?php require_once('Connections/xxxx.php'); ?>
<?php require_once('Connections/xxxx.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}

mysql_select_db($database_xxxx, $xxxx);
$query_totalhombres = "SELECT Count(sex) FROM encuesta_sex where sex='Masculino'";
$totalhombres = mysql_query($query_totalhombres, $xxxx) or die(mysql_error());
$row_totalhombres = mysql_fetch_assoc($totalhombres);
$totalRows_totalhombres = mysql_num_rows($totalhombres);

mysql_select_db($database_xxxx, $xxxx);
$query_Mujer = "SELECT Count(sex) FROM encuesta_sex where sex='Femenino'";
$Mujer = mysql_query($query_Mujer, $xxxx) or die(mysql_error());
$row_Mujer = mysql_fetch_assoc($Mujer);
$totalRows_Mujer = mysql_num_rows($Mujer);

mysql_select_db($database_xxxx, $xxxx);
$query_total = "SELECT Count(sex) FROM encuesta_sex";
$total = mysql_query($query_total, $gobierno) or die(mysql_error());
$row_total = mysql_fetch_assoc($total);
$totalRows_total = mysql_num_rows($total);
?><!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=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<style type="text/css">
<!--
.Estilo1 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 18px;
color: #FF00FF;
}
.Estilo2 {
font-family: Arial, Helvetica, sans-serif;
color: #0000FF;
font-size: 18px;
font-weight: bold;
}
.Estilo3 {
color: #009933;
font-weight: bold;
font-size: 18px;
font-family: Arial, Helvetica, sans-serif;
}
.Estilo4 {font-family: Arial, Helvetica, sans-serif}
.Estilo5 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; }
-->
</style>
</head>

<body>

<div align="center">
<p><img src="imagenes/banner.jpg" alt="xxxxx" width="780" height="137" /> </p>
<p>&nbsp;</p>
<p class="Estilo4">texto que quieran</p>
<table width="300" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr>
<td><span class="Estilo1">Total de Mujeres:</span></td>
<td><?php echo $row_Mujer['Count(sex)']; ?></td>
</tr>
<tr>
<td><span class="Estilo2">Total de Hombres:</span></td>
<td><?php echo $row_totalhombres['Count(sex)']; ?></td>
</tr>
<tr>
<td><span class="Estilo3">Total General:</span></td>
<td><?php echo $row_total['Count(sex)']; ?></td>
</tr>
</table>
<p class="Estilo5"><a href="index.php">Volver a Inicio</a></p>
</div>
</body>
</html>
<?php
mysql_free_result($Mujer);

mysql_free_result($total);

mysql_free_result($totalhombres);
?>