Re: [PHP] Array_diff problems

2012-04-27 Thread Rick Dwyer
Thanks to both for the direction.


 
 --Rick
On Apr 27, 2012, at 4:13 PM, Jim Giner wrote:

> 
> 
> Are these arrays nested in an array?  In that case the manual says you have 
> to do the compare differently.


On Apr 27, 2012, at 4:19 PM, admin wrote:

> 
> 
> -Original Message-
> From: Rick Dwyer [mailto:rpdw...@earthlink.net] 
> Sent: Friday, April 27, 2012 3:37 PM
> To: PHP-General
> Subject: [PHP] Array_diff problems
> 
> Hello all.
> 
> I have two arrays and when compared against each other via array_diff, I do
> not get any output:
> 
> $myarray1 = Array (
> [0] => Array ( [id] => 1 [Funding_Type] => Federal [Amount] => 10
> [Frequency_Description] => Total [Other_Funding] => ) [1] => Array ( [id] =>
> 2 [Funding_Type] => Trust [Amount] => 20 [Frequency_Description] => Per Year
> [Other_Funding] => ) [2] => Array ( [id] => 3 [Funding_Type] => Other
> Funding [Amount] => 30 [Frequency_Description] => Other [Other_Funding] =>
> some )) 
> 
> $myarray2 = Array
> (
> [0] => Array ( [id] => 1 [Funding_Type] => Federal [Amount] => 10
> [Frequency_Description] => Total [Other_Funding] => ) [1] => Array ( [id] =>
> 2 [Funding_Type] => Trust [Amount] => 20 [Frequency_Description] => Per Year
> [Other_Funding] => ) [2] => Array ( [id] => 3 [Funding_Type] => Other
> Funding [Amount] => 50 [Frequency_Description] => Other [Other_Funding] =>
> none )) 
> 
> $arraydifferences = (array_diff($myarray1,$myarray2));
> 
> I need $arraydifferences to record the differences between the two.
> 
> Any help is appreciated.
> 
> Thanks,
> 
> --Rick
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
> 
> 
> 
> I suggest you read Multidimensional array_diff for Nested Arrays and your
> format is not correct on the array that you gave an example of.
> 
> http://www.php.net/manual/en/function.array-diff.php#98680
> 
> 
> 
> 
> 
> 
> 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Array_diff problems

2012-04-27 Thread admin


-Original Message-
From: Rick Dwyer [mailto:rpdw...@earthlink.net] 
Sent: Friday, April 27, 2012 3:37 PM
To: PHP-General
Subject: [PHP] Array_diff problems

Hello all.

I have two arrays and when compared against each other via array_diff, I do
not get any output:

$myarray1 = Array (
[0] => Array ( [id] => 1 [Funding_Type] => Federal [Amount] => 10
[Frequency_Description] => Total [Other_Funding] => ) [1] => Array ( [id] =>
2 [Funding_Type] => Trust [Amount] => 20 [Frequency_Description] => Per Year
[Other_Funding] => ) [2] => Array ( [id] => 3 [Funding_Type] => Other
Funding [Amount] => 30 [Frequency_Description] => Other [Other_Funding] =>
some )) 

$myarray2 = Array
(
[0] => Array ( [id] => 1 [Funding_Type] => Federal [Amount] => 10
[Frequency_Description] => Total [Other_Funding] => ) [1] => Array ( [id] =>
2 [Funding_Type] => Trust [Amount] => 20 [Frequency_Description] => Per Year
[Other_Funding] => ) [2] => Array ( [id] => 3 [Funding_Type] => Other
Funding [Amount] => 50 [Frequency_Description] => Other [Other_Funding] =>
none )) 

$arraydifferences = (array_diff($myarray1,$myarray2));

I need $arraydifferences to record the differences between the two.

Any help is appreciated.

Thanks,
 
 --Rick



--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php



I suggest you read Multidimensional array_diff for Nested Arrays and your
format is not correct on the array that you gave an example of.

http://www.php.net/manual/en/function.array-diff.php#98680





 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Array_diff problems

2012-04-27 Thread Jim Giner

"Rick Dwyer"  wrote in message 
news:0c0e6cc9-089d-4938-8b50-c9e12dfb3...@earthlink.net...
Hello all.

I have two arrays and when compared against each other via array_diff, I do 
not get any output:

$myarray1 = Array (
[0] => Array ( [id] => 1 [Funding_Type] => Federal [Amount] => 10 
[Frequency_Description] => Total [Other_Funding] => )
[1] => Array ( [id] => 2 [Funding_Type] => Trust [Amount] => 20 
[Frequency_Description] => Per Year [Other_Funding] => )
[2] => Array ( [id] => 3 [Funding_Type] => Other Funding [Amount] => 30 
[Frequency_Description] => Other [Other_Funding] => some ))

$myarray2 = Array
(
[0] => Array ( [id] => 1 [Funding_Type] => Federal [Amount] => 10 
[Frequency_Description] => Total [Other_Funding] => )
[1] => Array ( [id] => 2 [Funding_Type] => Trust [Amount] => 20 
[Frequency_Description] => Per Year [Other_Funding] => )
[2] => Array ( [id] => 3 [Funding_Type] => Other Funding [Amount] => 50 
[Frequency_Description] => Other [Other_Funding] => none ))

$arraydifferences = (array_diff($myarray1,$myarray2));

I need $arraydifferences to record the differences between the two.

Any help is appreciated.

Thanks,

 --Rick

Are these arrays nested in an array?  In that case the manual says you have 
to do the compare differently. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Array_diff problems

2012-04-27 Thread Rick Dwyer
Hello all.

I have two arrays and when compared against each other via array_diff, I do not 
get any output:

$myarray1 = Array ( 
[0] => Array ( [id] => 1 [Funding_Type] => Federal [Amount] => 10 
[Frequency_Description] => Total [Other_Funding] => ) 
[1] => Array ( [id] => 2 [Funding_Type] => Trust [Amount] => 20 
[Frequency_Description] => Per Year [Other_Funding] => ) 
[2] => Array ( [id] => 3 [Funding_Type] => Other Funding [Amount] => 30 
[Frequency_Description] => Other [Other_Funding] => some )) 

$myarray2 = Array 
( 
[0] => Array ( [id] => 1 [Funding_Type] => Federal [Amount] => 10 
[Frequency_Description] => Total [Other_Funding] => ) 
[1] => Array ( [id] => 2 [Funding_Type] => Trust [Amount] => 20 
[Frequency_Description] => Per Year [Other_Funding] => ) 
[2] => Array ( [id] => 3 [Funding_Type] => Other Funding [Amount] => 50 
[Frequency_Description] => Other [Other_Funding] => none )) 

$arraydifferences = (array_diff($myarray1,$myarray2));

I need $arraydifferences to record the differences between the two.

Any help is appreciated.

Thanks,
 
 --Rick



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] url string being split

2012-04-27 Thread Chris Stinemetz
On Fri, Apr 27, 2012 at 11:09 AM, Shawn McKenzie  wrote:
> On 04/27/2012 10:56 AM, Chris Stinemetz wrote:
>> I still haven't been able to find a solution. Is there anyone out
>> there that knows how to keep the query string intact?
>>
>> Thank you,
>>
>> Chris
>
> urlencode($storerow['store_subject'])
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com

Thank you. That is what I was looking for.

-Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] url string being split

2012-04-27 Thread Tim Streater
On 27 Apr 2012 at 16:56, Chris Stinemetz  wrote: 

> On Thu, Apr 26, 2012 at 12:58 PM, Stuart Dallas  wrote:
>> On 26 Apr 2012, at 18:37, Jim Giner wrote:
>>
>>> I"m no expert, but why would you expose a query to the world thru the use of
>>> a GET?  Why not just collect the params and build the string in your code?
>>> That is how people hack into your database - via a re-formed query.  You're
>>> giving someone an open invitation.
>>
>> A "query string" has nothing to do with databases.

> I still haven't been able to find a solution. Is there anyone out
> there that knows how to keep the query string intact?

As was posted previously, you need to encode the query string. If you have:

   http://westeng/forum/store.php?id=Wiser Communication, LLC -& - Sprague Ave

that is going to be split in two unless you encode the "Wiser Communication, 
LLC -& - Sprague Ave" portion. I would do that with JavaScript on the html page.

This is not a PHP question.

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] url string being split

2012-04-27 Thread Shawn McKenzie
On 04/27/2012 10:56 AM, Chris Stinemetz wrote:
> I still haven't been able to find a solution. Is there anyone out
> there that knows how to keep the query string intact?
> 
> Thank you,
> 
> Chris

urlencode($storerow['store_subject'])

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] url string being split

2012-04-27 Thread Chris Stinemetz
On Thu, Apr 26, 2012 at 12:58 PM, Stuart Dallas  wrote:
> On 26 Apr 2012, at 18:37, Jim Giner wrote:
>
>> I"m no expert, but why would you expose a query to the world thru the use of
>> a GET?  Why not just collect the params and build the string in your code?
>> That is how people hack into your database - via a re-formed query.  You're
>> giving someone an open invitation.
>
> A "query string" has nothing to do with databases.
>
> -Stuart
>

I still haven't been able to find a solution. Is there anyone out
there that knows how to keep the query string intact?

Thank you,

Chris

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Insert group by

2012-04-27 Thread admin
$sql='select count(*) as count, searchkeywords 
from searchkeywords 
group by searchkeywords 
having searchkeywords LIKE searchkeywords
order by count desc'


Ir this does not work for you explore the HAVING CLAUSE





-Original Message-
From: Rick Dwyer [mailto:rpdw...@earthlink.net] 
Sent: Thursday, April 26, 2012 8:23 PM
To: PHP-General
Subject: [PHP] Insert group by

Hello all.

This is more of a MySQL question, but I'm hoping it can be answered here.
On one of my pages, I issue a SQL command to group data as such:

$sql='select count(*) as count, searchkeywords from searchkeywords group by
searchkeywords order by count desc'

Works well... but I would like it to groups plurals with singular words as
well.  So "hats" are grouped with "hat".

Since I'm doing a "group by" column name, I don't know that this can be
done.

Any help is appreciated.

Thanks,
 
 --Rick



--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Serving a .dmg via readfile?

2012-04-27 Thread Matijn Woudt
On Thu, Apr 26, 2012 at 8:20 PM, Brian Dunning  wrote:
> Thanks, this suggestion from Dante completely solved the problem.
>
> Replaced:
>
> readfile('/var/www/mypath/My Cool Image.dmg');
>
> With:
>
> $fd = fopen ('/var/www/mypath/My Cool Image.dmg', "r");
> while(!feof($fd)) {
>    set_time_limit(30);
>    echo fread($fd, 4096);
>    flush();
> }
> fclose ($fd);
>
> It's now serving all files properly.
>

It is indeed a better solution, but as always, you should've checked
the apache logs first and you would've noticed an PHP error probably
about not enough memory..

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Insert group by

2012-04-27 Thread Lester Caine

Rick Dwyer wrote:

This is more of a MySQL question, but I'm hoping it can be answered here.
On one of my pages, I issue a SQL command to group data as such:

$sql='select count(*) as count, searchkeywords from searchkeywords group by 
searchkeywords order by count desc'

Works well... but I would like it to groups plurals with singular words as well.  So 
"hats" are grouped with "hat".

Since I'm doing a "group by" column name, I don't know that this can be done.

Any help is appreciated.


This IS a more appropriate question for ANY of the other database lists ;)

Normal practice is to create a search field that has your preferred search 
style, so add 'filtered_searchwords' and populate it with say a lower case copy 
of searchkeywords with any "s" or "'s" text removed. That is unless you want 
Hat's counted separately?


Expecting the database to process this type of filtering with any speed is being 
a bit hopeful. What any database does is processes raw fields fast, so providing 
extra data at insert or edit time is much more efficient than trying to do that 
process on every row of data later.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php