Hi

I put in the main page one mini-panel which contain php code written by me. I am very fresh in php so I could think that I made there any mistake BUT one week ago this code was working.

Here is the code:

require "funkcje.php";
    $tid1="select tid from term_data where name='Zastosowanie'";
	//print $tid1;
    $tid1=zapytanie($tid1,'tid');
	//print_r($tid1);
	$nid1="select nid from term_node where tid='".$tid1[0]."' order by nid desc";
	//print $nid1;
    $nid2=zapytanie($nid1,'nid');
	//print_r($nid2);
	//print count($nid2);
	$pole='select nid from content_type_knowledge where field_wideo_value is not null order by nid desc';
	$pole=zapytanie($pole,'nid');
	//print_r($pole);
	$wideo="select field_wideo_value from content_type_knowledge where nid='".$pole[0]."'";
	$wideo=zapytanie($wideo,'field_wideo_value');
	print $wideo[0];
	

in funkcje.php there is following code

function zapytanie($sql,$pole)
{
$result = db_query($sql);
  while ($row_exists = db_fetch_array($result)) {
    $rows[]=$row_exists[$pole];
	//print_r($rows);
	}
	
	return $rows;
}

and here is the error

Fatal error: Cannot redeclare zapytanie() (previously declared in /home/xxx/public_html/includes/common.inc(1685) : eval()'d code:2) in /home/xxx/public_html/includes/common.inc(1685) : eval()'d code on line 2

Does anyone know what it can means?

Thanks in advance for help

Comments

j_ten_man’s picture

Try a require_once instead of require. That is probably what is killing it.

lukas84r’s picture

Thank you very much for help it seems to work.