[FX.php List] urlencode() expects parameter 1 to be string, array given

DC dan.cynosure at dbmscan.com
Thu Nov 9 13:10:08 MST 2006


sometimes i've seen people with strange errors and it turns out that the 
FX.php file they thought they were using was not the file they were 
using. are you sure you are using the same FX.php file in both cases?

dan

Ben Bradley had written:
> Changing the error level does make the error disappear - but I'm still
> none the wiser as to why this is actually happening!
> 
> The thing I don't understand is there are no variables being passed to
> FX.php that are arrays.
> And all the data in the FX.php command are all set as strings - not
> using variables
> 
> Here's the contents of my script around the FX calls...
> 
>    // CHANGE ERROR REPORTING LEVEL
>    error_reporting( E_ERROR );
> 
>    include('FX.php');
>    // FMP QUERY TO GET ARRAY OF ALL TAGS
>    $fmp_query = new FX('xxx.xxx.xxx.xxx', '591', 'FMPro5/6');
>    $fmp_query->SetDBData('TAGS', 'WEB', 'All');
>    $fmp_query->SetDBPassword('password', 'username');
>    $fmp_query->AddDBParam('CATEGORY', 'XREF AMD');
>    $fmp_query->AddSortParam('NAME', 'ascend', 1);
>    $fmp_result = $fmp_query->FMFind(true, full, false);
> 
>    $found_count = $fmp_result['foundCount'];
>    $fmp_error_code = $fmp_result['errorCode'];
> 
>    $columncounter = 1;
> 
>    // LOOP THROUGH RECORDS
>    foreach ($fmp_result['data'] as $key => $fmp_row) {
> 
>        $tag_id = $fmp_row['ID'];
>        $tag_name = $fmp_row['NAME'];
>    }
> 
> 
> I don't understand how it can be something to do with my data being
> passed to FX.php, when the above code works fine when posted on its
> own page with nothing else.
> 
> 
> Also I've tried looking through FX.php to line 1425 and there doesn't
> seem to be a urlencode() function on that line in FX.php
> 
> 
> I will continue to search!!
> 
> 
> Thanks
> 
> Ben
> 
> 
> On 09/11/06, Steve Hannah <shannah at sfu.ca> wrote:
> 
>>
>> This is where a little bit of old fashioned debugging comes in to 
>> play.  If PHP says that you passed an array into urlencode() then you 
>> probably did (PHP doesn't usually lie).
>>
>>
>> Try adding some print and print_r statements in and around the error 
>> message so you can see exactly what data is being passed around.
>>
>>
>> In particular, do print_r($var_name) (where $var_name is the name of 
>> the variable passed to urlencode()) just before the offended 
>> urlencode() call, to see what this array is.. ...
>>
>>
>> etc..
>>
>>
>> The truth will be revealed when you see what is in your variables.
>>
>>
>> Best regards
>>
>>
>> Steve
>>
>>
>> ----------------------------------------
>> Steve Hannah
>> Web Services Developer
>>
>>
>> Faculty of Applied Sciences
>> Simon Fraser University
>> shannah at sfu.ca
>> 778-782-7228
>> Homepage: http://www.sjhannah.com
>> -- 
>> Need to build a database driven web application quickly?
>> Try Dataface: http://fas.sfu.ca/dataface
>>
>>
>>
>>
>>
>>
>> On 9-Nov-06, at 10:45 AM, Ben Bradley wrote:
>>
>>
>> Hi everyone
>>
>> I've been using FX.php very successfully over the last 6 months to 
>> gradually build an intranet database application.
>>
>> Some of the old pages on our website still use a botched-job way of 
>> getting data out of FileMaker and into PHP - building a CDML query eg 
>> http://server.domain.com:591/?FMPro-DB=TEST etc...
>> Then on the format files I would have some PHP code which captured the 
>> filemaker data and turned it into a PHP variable.
>> Then I would run an include on that CDML query address which would 
>> pull in that code and have the filemaker data saved into PHP 
>> variables. Although this method works, it would encounter problems 
>> when trying to include a query string that was too long, or trying to 
>> save data into a filemaker database was particularly tricky.
>>
>> Anyway now with FX.php I'm having a problem accessing data from our 
>> database.
>>
>> The PHP error I'm getting is...
>> Warning:  urlencode() expects parameter 1 to be string, array given in 
>> /files/home3/dealerworld/FX.php  on line 1425
>>
>> But the data gets outputted correctly just underneath that error message.
>>
>>
>> The actual live page to see this happening is here...
>>  http://www.dealer-world.com/page.php?p=amddirectory&s=listingform1
>>
>> But you'll have to fill in some dummy information to get to the 2nd 
>> page of the form where the error's happening - just above the checkboxes.
>> It is these checkbox names which are being dragged out of our 
>> FileMaker database
>>
>> I've set up a test page where I've literally copy and pasted the code 
>> from that listingform2 page and I don't get the error, even though the 
>> PHP code is exactly the same...
>> http://www.dealer-world.com/fxtest.php
>>
>>
>> The only difference between the 2 scripts could be that when I'm 
>> getting the error, I'm calling FX.php from within an included script.
>> Would that cause the problem I'm looking at here?
>>
>> Any ideas / suggestions?
>> I find it strange how I get the error on the main site, but not on my  
>> fxtest.php page.
>>
>>
>> Best regards
>>
>> Ben
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
> 


More information about the FX.php_List mailing list