Cannot Modify header information error when using delegate c
Archived from the Xataface Users forum.
Aoirthoir — Wed Nov 08, 2006 1:45 am
I will start with the error….
Warning: Cannot modify header information - headers already sent by (output started at /media/www_testing/dfapps/estim/tables/patients_dates/patients_dates.php:16) in /media/www_libraries/dataface-0.6.9r1/actions/new_related_record.php on line 100
I have several delegate classes which are for tables based upon my patients table. The delegate classes are the ones I posted in here about attaching the patient name to a child tables title and firefox tab.
I tried removing the delegate classes. Each time I remove one, the next one seems to kick in. And so for instance that error above came when i was saving a related record to my patients_notes table. If I remove patients_dates.php then patients_electrical_stim_units.php will give the error. And so on until I remove all of the delegate classes. I am posting all of the files that I think are relative. I will post more if need be.
Here is my relationships.ini:
[patients_notes]
action:label = Notes
actionrder = 50
actions:addexisting = 0
patients_notes.acct = “$acct”
[patients_dates]
action:label = Dates
actionrder = 52
actions:addnew = 0
actions:addexisting = 0
patients_dates.acct = “$acct”
Now my patients.php delegate class:
val(‘name_first’);
$middlename=$record->val(‘name_middle’);
$lastname=$record->val(‘name_last’);
$fullname=$firstname.’ ‘.$middlename.’ ‘.$lastname;
return $fullname;
}
}
?>
Now my child tables delegate classes:
And finally my fullname.inc file from above:
db();
$currentrecord=$record->val(‘acct’);
$query=”SELECT * FROM patients where acct=”.”’”.$currentrecord.”’”;
$result=mysql_query($query);
$firstname=mysql_result($result,0,”name_first”);
$middlename=mysql_result($result,0,”name_middle”);
$lastname=mysql_result($result,0,”name_last”);
$fullname=$firstname.’ ‘.$middlename.’ ‘.$lastname;
?>
Any suggestions would be appreciated. However this is not currently a time sensitive issue. I simply removed the ability on child records for the title to change.
Thank you kindly.
shannah — Wed Nov 08, 2006 12:29 pm
OK.. the error that you quoted here indicates that PHP is outputting something on line 16 of patient_dates.php .
There are 2 possibilities here:
- On line 16 there is an echo statement.
- patient_dates.php is only 16 lines long, and there is some extra white space (or hidden characters) after the closing PHP tag.
Solutions:
-
Remove any such white space or echo statements (try different text programs if the white space isn’t showing up in your editor… it is there).
-
Use output buffering by adding a call to ob_start(); at the first line of your application’s index.php file. This will prevent your script from outputting anything until execution completes.
Best regards
Steve
Aoirthoir — Wed Nov 08, 2006 4:33 pm
Ah..I keep getting that extra space at the end thing. Sorry for the trouble again Mr. Steve. I will give that a try.