
Untitled
By: a guest on
May 9th, 2012 | syntax:
None | size: 1.64 KB | hits: 19 | expires: Never
Get array of all matches in mysql query?
$wonAwards = $altdb->get_var("SELECT achievement_id
FROM user_1
WHERE isTold='false'");
function the_header_function(){ //called when wordpress header is loaded
if (is_user_logged_in()){ //checks if user is logged in
global $altdb; //wp global database object
$user_info = wp_get_current_user();
$wonAwards = $altdb->query("SELECT achievement_id FROM user_".$user_info->ID." WHERE isTold='false'"); //query
if(is_array($wonAwards)) $hello='true';
if(!is_array($wonAwards)) $hello='false';
if($wonAwards != ''){
echo "<script>jQuery(document).ready( function(){alert('".$hello."');});</script>";
}
}
}
echo "<script>jQuery(document).ready( function(){alert('".$hello."');});</script>";
echo "<script>jQuery(document).ready( function(){alert('".$wonAwards."');});</script>";
$wonAwards = $altdb->get_results("SELECT achievement_id
FROM user_1
WHERE isTold='false'");
$wonAwards = $altdb->get_var("SELECT achievement_id
FROM user_1
WHERE isTold
IN ('false', 'true', 'another_value', 'some_other')");
$array = array("data1", "data2", "data3");
$implode = implode("', '", $array);
//Output or $implode
data1', 'data2', 'data3
//apply on query
$wonAwards = $altdb->get_var("SELECT achievement_id
FROM user_1
WHERE isTold
IN ('$implode')");