Yes, it could be something inside the code it's requiring that is  
issuing a header. But it could still be an error in the code inside  
your index.php page. I'm not aware of anything in MAR itself that can  
cause this error.

Try this (it's a good general debugging trick): inside the index.php,  
comment out all of the header() calls, and then access the page using  
Firebug. Look at the response (in Firebug's Console tab) to see what,  
if anything, is being printed to the browser. You may have an error in  
there that isn't being properly trapped, although I'm not seeing it if  
that's the case.

Walter

On Jul 3, 2009, at 11:31 AM, WLQ wrote:

>
> Could the "require_once" do something? Because this is the only
> outside content I have. In particularly it's the index.php - so this
> way the database and everything else is configured.
>
>
>> Check your script for any whitespace (spaces, newlines, anything at
>> all) outside of the <?php ?> delimiters. Something is printing some
>> content to the page buffer before the header is being sent, and  
>> that's
>> the problem. It doesn't need to be anything you wrote, it could be an
>> extra space at the top of your script, or if your text editor likes  
>> to
>> put a BOM at the top of the file, it could be that.
>>
>> Walter
>>
>> On Jul 3, 2009, at 9:54 AM, WLQ wrote:
>>
>>
>>
>>> Unfortunately it's not them who create a problem.
>>
>>> THis is the code I use:
>>
>>> $original = $_POST['original'];
>>> if($master = MyActiveRecord::FindById('widgets',$original)){
>>>        $data = get_object_vars($master);
>>>        array_shift($data);
>>>        $new = MyActiveRecord::Create('clones',$data);
>>>        $new->save();
>>>        if(false === $new->get_errors()){
>>>                header('Content-type: text/html; charset=utf-8');
>>
>>>                print 'item_' .  $new->id;
>>>        }else{
>>>                header('HTTP/1.0 500 Server Error',true,500);
>>>                exit;
>>>        }
>>> }else{
>>
>>>        header('HTTP/1.0 404 Missing',true,404);
>>
>>> }
>>
>>>> Those errors wont occur when you remove the "echo" / "print_r"
>>>> statements
>>>> ... they are just moaning about the web server detecting content  
>>>> and
>>>> expressing its own headers...
>>
>>>> If you remove the lines i asked u to add it will be fine
>>
>>>> Alex
>>
>>>> ----- Original Message -----
>>>> From: "WLQ" <maybe...@gmail.com>
>>>> To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com
>>
>>>> Sent: Friday, July 03, 2009 1:53 PM
>>>> Subject: [Proto-Scripty] Re: MySQL - order
>>
>>>> Well
>>
>>>> widgets Object ( [id] => 3 [name] => 3.00 [description] => 3
>>>>> [position] => 3 [updated_at] => 2009-06-05 14:39:07 )
>>
>>>>> And the second one ($original) returned an id of 3. So the  
>>>>> answer is
>>>>> you should write $master instead of $original.
>>
>>>>> So this problem is solved, but the errors won't stop. You solve  
>>>>> one
>>>>> problem and here you go another one:
>>>>> Cannot modify header information - headers already sent by (output
>>>>> started at:1) LOCATION: line 8
>>
>>>>>> If anything it should be $master as thats what is most likely to
>>>>>> be an
>>>>>> array.... I dont know MAR at all but unless it parses the  I do
>>>>>> into a
>>>>>> loop
>>>>>> then t is inal is moe likt into be an id/string/int thaMAR
>>>>>> array...
>>
>>>>>> To test
>
>
>>
>>>> er............ {
>>
>> ray.y.> p
>>>> t_r($master); // shto d return .. {
>>
>>>>>> eay
>>> an array or
>>>>>> object)
>>
>>>>>> ----- igininal Message -----
>>>>>> Fm:/:/ shQ" <maybe...@gmail.com>
>>>> (noTo: "Prototype & script.aculo.us"
>>>>>> <prototype-siptptacul...@googlegroups.com>
>>>> S Sent: Friday, July 03, 2009 12:51 PM
>>>>>> Subject: [Proto-Scripty] Re: MySQL - order ID
>>>>> orde
>>>>> ID
>>
>>>>> d it then be:
>>>>>> $data get_tbject_v_vars($master);
>>
>>>>>> Instd ofof:
>>>>>> $data = get_object_var ordei ID
>>
>>>>>> be:
>>>> a>> $datgh the s the  and third line;
>>>> owly and carefully. Look at
>>>>>>>> each variable that is being t andnd each variable that is being
>>>>>>>> read.
>>>>>>> (Variables ly. Le left of the = are being set.) Ask yourself
>>>>>>> what it's
>>>>>>> supposed to be carrying, andee if f you can spot what it  
>>>>>>> really is
>>>>>>> instead.
>>
>>>>>>> Here's a hint: In line two, I assigned a value to a variable,
>>>>>>> but on
>>>>>>> line 3, I forgot to use it and used something else instead.
>>
>>>>>>> Walter
>>
>>>>>>> On Jul 2, 2009, at 6:09 AM, WLQ wrote:
>>
>>>>>>>> This is as far as I've been able to go, please tell what's  
>>>>>>>> wrong.
>>
>>>>>>>> $original = $_POST['original'];
>>>>>>>> if($master = MyActiveRecord::FindById('widgets',$original)){
>>>>>>>> $dat> $data = get__vject_varginal);
>>>>>>>> if ( is_array($data)
>>>>>>>> arra
> rshift($d($data);
>>>>>>>> $new = MyA> > $da= g= gereobject_vn,>> >>> if ( i( is
>>>> rray($da$new->save();
>>> == $ntw->gors()){
>>>>>>>> header('ContA> > yda= g= g/html; chet=utf-8')8
>>>
>>>>>>>> //tve();
>>>> ift iou you need:
>>>>>>>> pririr'r'i.e'i.em_ew->id header('C
> ntenstens >>>>
>>>>>>> he>HTTP/1.T 50.0 500 Server Erroue,true,50 >>
>>> t   ft  eu ne
>>>>>>>> }
>>>>> itet itese>
>>
> se{
>>> . >>04 M
>>> .',true,41.0;
>>
>>>>>>>> ror
>>
>>> ht
>>>>>>>>> there
>>>>>>>>> in fr>> >>f you.
>>
>>>>>>>>> Walter
>>>>>>
>>>>>>>> On Jul 1, 2009, at 1:36 PM, WLQ wrote:
>>
>>>>>>>>>> I understand unshould plem, is:
>>>>>>>>>> if(is_array($data)) {
>>>>>>>>>> array_shift($data);
>>>>>>>>>> }
>>
>>>>>>>>>> Instead of:
>>>>>>>>>> array_shift($data);
>>
>>>>>>>>>>> Or jus>>>> ....
>>
>>>>>>>>>>> if(is_array($data)) {
>>>>>>>>>>> array_shift($data);
>>
>>>>>>>>>>> }
>>
>>>>>>>>>>> HTH Alex
>>
>>>>>>>>>>> ----- Original Message -----
>>>>>>>>>>> From: "Walter Lee Davis" <wa...@wdstudio.com>
>>>>>>>>>>> To: <prototype-scriptaculous@googlegroups.com>
>>>>>>>>>>> Sent: Wednesday, July 01, 2009 5:56 PM
>>>>>>>>>>> Subject: [Proto-Scripty] Re: MySQL - order ID
>>
>>>>>>>>>>>> Which means it's not getting an array. So look and see
>>>>>>>>>>>> whate whaS
>>>>> it IS
>>>>>>>> getting. What is the value of $dvaluetof $datoint? (Use echo(),
>>>>>>>>>>>> print_r(), see that it ke that to output the value.)
>>
>>>>>>>>>>>> I can see tI canrsee ight away, looking back over thhat ie
>>>>>>>>>>>> the va
>>>>>>>>>>>> a
>>>>>> s  >>>>> fairly stupid error on my part intmyduced while
>>>>>> refactoring the
>>>>> he va>ue.)working code into an example you could pick coult pnd
>>>>> learn from l
>>
> r
>>>>>>>>>>>> stand on
>>>>>>>>>>>> your
>>>>>>>>>>>> own here.
>>
>>>>>>>>>>>> Walter
>>
>>>>>>>>>>>> On Jul 1> you9, at 10:31 AM, WLQ wrote:
>>
>>>>>>>>>>>>> But here's what I get in error:
>>>>>>>>>>>>> array_shift() [function.array-shift]ere's what I t should
>>>>>>>>>>>>> be an
>>>>>>>>>>>>> array
>>
>>>>>>>>>>>>> On this line:
>>>>>>>>>>>>> array_shift($data);
>>
>>>>>>>>>>>>>> Yes. Like any example that you will ever find on the Web,
>>>>>>>>>>>>>> this
>>>>>>>>>>>>>> one
>>>>>>>>>>>>>> needs to be adjusted to match your environment. Some  
>>>>>>>>>>>>>> basic
>>>>>>>>>>>>>> fluency in
>>>>>>>>>>>>>> PHP is a requirement to use the MAR system, it can't  
>>>>>>>>>>>>>> divine
>>>>>>>>>>>>>> everything
>>>>>>>>>>>>>> for you.
>>
>>>>>>>>>>>>>> Walter
>>
>>>>>>>>>>>>>> On Jul 1, 2009, at 5:57 AM, WLQ wrote:
>>
>>>>>>>>>>>>>>> Right, shouldn't then that be 'widgets'? Because the
>>>>>>>>>>>>>>> table of
>>>>>>>>>>>>>>> our
>>>>>>>>>>>>>>> original sortable list were controlled by the widgets
>>>>>>>>>>>>>>> table.
>>>>>>>>>>>>>>> So
>>>>>>>>>>>>>>> like:
>>>>>>>>>>>>>>> if($master = MyActiveRecord::FindById('widgets',
>>>>>>>>>>>>>>> $original)){
>>
>>>>>>>>>>>>>>>> Originals is a table in the database, it contains one
>>>>>>>>>>>>>>>> of each
>>>>>>>>>>>>>>>> type of
>>>>> pe of
>>>>>>>>>>>>>> thinu wish to be able to clone into the clones table.
>>>>>>>>>>>>>>>> MyActiveRecord   to be able to
>> lone int>> teach table you "wrap"
>>>>>>>>>>>>>>>> it
>>>>>>>>>>>>>>>> around, and each row ofsh to be able om clone iject of
>>>>>>>>>>>>>>>> that
>>>>> hat
>>>>>>>>>>>>> class
>>>>>>> cl>>>>>>> when
>>>>>>>>>>>>>>>> you request it through MAR.
>>
>>>>>>>>>>>>>>>> In shf that
>>>>>>>>>>>>>>>
>
>>>>>>>> f the>>> if($master =
>>>>>>>>>>>>>>>> MyActiveRecord::FindById('origina>>>>>>>>> when){
>>
>>>>>>>>>>>>>>>> ...if it finds aord::e called 'originals' in  inr
>>>>>>>>>>>>>>>> database,
>>>>>>>>>>>>>>>> will
>>>>>>>>>>>>>>>> ret return the rothwith thematching $original (or  
>>>>>>>>>>>>>>>> false).
>>>
>>>>>>>>>>>>>>>> Walter
>>
>>>>>>>>>>>>>>>> On Ju>>>>> return t 1 row wit W >>>>>>>>>>>>>
>> Walter
>>
>>>>>>>>>> It says - Class originals does not exist
>>>>>>>>>>>>>>>>> iginal (or fal o).
>>
>> ss  class comes from? What is the
>>>>>>>>>>>>>>>> originals
>>>>>>>>>>>>>> ass from
>>>>>> What is>the
>>>>>>> above?
>>
>>>>>>>>>>>>>>>>>> If this is  >  code you arhere doe( the origind>  the
>>>>>>>>>>>>>>>>>> missing
>>>>>>>>>>>>>>>>>> close
>>>>>>>>>>>>>>>>>>> parenthesis), then the fact that you are g close a
>>>>>>>>>>>>>>>>>>>> 200 back
>>>>>>>>>>>>>>>>>> (and a
>>>>>>>>>>>>>>>>>> new
>>>>>>>>>>>>>>>>>> ID) means that you have successfully created a new
>>>>>>>>>>>>>>>>>> clone.
>>>>>>> u have>>>>> Othelly creat
>>>>>>>>>>>>>>>>> you should be getting a 500 or 404 back.
>>
>>>>>>>>>>>>>>>>>> //create_clone.php
>>>>>>>>>>>>>>>>>> $original = $_POST['original'];
>>>>>>>>>>>>>>>>>> if($master = MyActiveRecord::FindById('originals',
>>>>>>>>>>>>>>>>>> $original)){
>>>>>>>>>>>>>>>>>> $data = get_object_vars($rs(ginal);
>>>>>>>>>>>>>>>>>> array_shift($data); //get rid of the ID
>>>>>>>>>>>>>>>>>>>>> $new = MyAeRiveRecctreate('clones',$data);
>>>>>>>>>>>>>>>>>> $new->save();
>>>>>>>>>>>>>>>>>> if(false>>>>>>>> $new _eMyActiveay_
>>>>>>>>>>>>>>>>>>>>>>>>>>> nt> if(fal: text/html;
>>>>>>>>>>>>>>>>>> charset=utt=utfones',$data);
>>
>>> //this is the part you need>>>>
>>>>>>>>>>>>>>>> print 'item_' . $new->id;
>>>>>>>>>> harset=utheade8'){
>>>>>>>>>>>>>>>>> heem_' . $new->id;
>> Server Error',true,
>>>>>>>>>>>>>>>>>>>> 50;
>>>>> );
>>> he part you need:
>>> exit;
>>>>>>>>>>>>>>>>>>> }}else{
>>
>>>>>>>>>>>>>>>>>> header('HTTP/1.0 404 Missing'>>>>>>>0> er('H
>>
>>>
>>>>
>>>>>>>>>>>>>>>>>>> }
>>
>>> with the Console tab
>>>>>>>>>>>>>>>>>> of
>>>>>> exit;>> >> >  Firebug
>>>>>>>>>>>>>>>>>> o>>>>>>>ke sure Firebug is set to show XHR
>>>>>>>>>>>>>>>>>> transactions.
>>>>>>>>>>>>>>>>>> You
>>
>>>>>> ith th>>>> should
>>>>>>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>>> able to observe the request to create_clone, a>>
>>>>>>>>>>>>>>>>>> ablethe
>>>>>>>>>>>>>>>>>> reply
>>>>>>>>>>>>>>>>>> from
>>>>>>>>>>>>>>>>>>> the server. The reply should be the new ID of your
>>>>>>>>>>>>>>>>>>> clone.
>>>>>>>>>>>>>>>>>>> If
>>>>>>>>>>>>>>>>>> it
>>>>>>>>>>>>>>>>>> isn't,
>>>>>>>>>>>>>>>>>> t>>> >>u have more debugging to do.
>>
>>>>>>>>>>>>>>>>>> Things to check here:
>>
>>>>>>>>>>>>>>>>>> * Have you included/required theck herry
>>>>>>>>>>>>>>>>>> (MyActiveRecord)
>>>>>>>>>>>>>>>>>> in
>>
>> ...
>>
>> read more ยป
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to