All pastes #804511 Raw Edit

Mine

public text v1 · immutable
·published 2007-12-03 15:24 UTC
rendered paste body
Got 2 functions :   gengo_get_cat_intro & gengo_id_from_mk.
gengo_cat_intro calls gengo_id_cat.
An ID should be returned.
The problem is that :
-gengo_cat_intro "launches" gengo_id_from_mk.  It works because it echoes 477.
But the line after; I return this ID to use it back in gengo_get_cat_intro; and there, it tells me $intro_id does not exists !!!
Did I miss something ?

THanks !


function gengo_id_from_mk($meta_key,$meta_value,$langcode='',$takeback='0') {

	if ((empty($meta_key)) || (empty($meta_value))) {
		return;
	}
	if (empty($langcode)) {
		$langsearch = 1;
	} else {
		$langsearch = $langcode;
	}
	$now = current_time('mysql');
	
	$query="SELECT ID FROM........'";
	
	$id = $wpdb->get_var($query);
	
	if ($id) {
		echo $id; //WORKS : IT OUTPUTS 477
		return $id;
	} else {
		if ((empty($langcode)) && ($takeback=='1')) { // if takeback==1; loop to check with default language
			gengo_id_from_mk($meta_key,$meta_value,1);
		}
	}
}

function gengo_get_cat_intro($cat) {
	$intro_id = gengo_id_from_mk('intro_cat',$cat,'',1);
	if ($intro_id) {
		echo 'success';
	} else {
		echo 'failure'; //IT OUTPUTS FAILURE; OR MY ID WAS FOUND IN THE OTHER FUNCTION !
	}