Created
October 15, 2015 14:52
-
-
Save Dinamiko/6a921525f912ec3661eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Devuelve el total de registros donde el campo respuesta es igual valor $respuesta | |
* @param string $valor respuesta | |
* @return int $registros total registros | |
*/ | |
function encuesta_get_registros_respuesta( $respuesta ) { | |
if( $respuesta ) { | |
global $wpdb; | |
$table_name = $wpdb->prefix . "encuesta"; | |
$registros = 0; | |
$total = $wpdb->get_results( "SELECT * FROM $table_name" ); | |
foreach ( $total as $registro ) { | |
if( $registro->respuesta == $respuesta ) { | |
$registros++; | |
} | |
} | |
return $registros; | |
} else { | |
return false; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment