Podczas rozwiązywania problemu, udało mi się ustalić iż zmienia sie typ zmiennej
Dlaczego tak się dzieje i jak mogę zwrócić int?
public function checkURL()
{
$this -> url = isset($_GET['page']) ?
$_GET['page'] : Null; $this -> resultURL = NULL;
$db = NewADOConnection($this -> db());
$db -> debug = true;
$db -> SetFetchMode(ADODB_FETCH_ASSOC);
$this -> checkURL = $db -> GetArray('SELECT id, url FROM section WHERE status > 0');
$db -> Close();
for ($i=0; $i < sizeof($this -> checkURL); $i++) {
#jezeli istnieje zwraca true
if (strstr($this -> checkURL[$i]['url'], $this -> url)) $this -> urlID = $this -> checkURL[$i]['id'];
}
#NAJCIEKAWSZE =====================================================
$this -> goodURL = settype($this -> urlID, "integer"); return $this -> urlID;
}
public function dataFromStaticpage()
{
$this -> goodURL = settype($this -> checkURL(), "integer");
if($this -> goodURL !== NULL)
{
$db = NewADOConnection($this -> db());
$db -> debug = true;
$db -> SetFetchMode(ADODB_FETCH_ASSOC);
$resulturl = $db -> GetArray('SELECT * FROM section WHERE id = '.$this -> goodURL);
$db -> Close();
}
else
{
}
}
typ0: string
typ1: boolean
typ2: boolean
Ten post edytował matyskiewicz 7.04.2010, 12:48:32