php-general Digest 17 Oct 2007 08:20:28 -0000 Issue 5076
Topics (messages 263225 through 263253):
Re: Screenshot from web page
263225 by: Rodolfo De Nadai
263230 by: Philip Thompson
263231 by: Stut
263235 by: Rodolfo De Nadai
Re: Which PHP-Editor to use?
263226 by: mooor
263227 by: Zoltán Németh
263228 by: Stut
263229 by: Philip Thompson
263234 by: marek
263237 by: Bastien Koert
263250 by: Matt Livingston
263251 by: Tom Ray [Lists]
Find PHP install directory
263232 by: Philip Thompson
263238 by: Philip Thompson
combining 2 arrays
263233 by: Ladislav Andel
263236 by: Miles Thompson
263239 by: Ladislav Andel
263240 by: Ladislav Andel
263241 by: Paul Scott
263242 by: Greg Donald
263245 by: Philip Thompson
263246 by: James Ausmus
263247 by: Ladislav Andel
263248 by: Ladislav Andel
263249 by: Daevid Vincent
263252 by: James Ausmus
Should I use an array in a form / how?
263243 by: ron.php
263244 by: Philip Thompson
php gallery for pictures and videos
263253 by: zakaria ghandour
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Here are php functions that you are looking for... long time ago i found
this, but can't remenber anymore the functions names, but i know that
was possible!!!... so a search google again and give me:
http://blog.thepimp.net/index.php/post/2007/04/17/Screen-capture-with-PHP-and-GD
But here the references on php documentation:
http://php.oregonstate.edu/manual/en/function.imagegrabscreen.php
http://us3.php.net/manual/en/function.imagegrabwindow.php
hope this helps
Richard Heyes escreveu:
I would like to make web page screenshot and generate an image for
example .jpg or .png using PHP,Apache.
If any one has experiance in doing that please help.
I know that there are lot of services like that, but I don't want to
use them.
In real I need that to generate screenshot of my local server pages.
There is a firefox extension called "screengrab" to do just that...
The results are, well, perfect! the URL is:
https://addons.mozilla.org/es-ES/firefox/addon/1146
If you're not talking about automated screenshots, and you're using
Windows, just press your "PrtScr" button. Hold down Alt as well to get
just the active window. This will put the screenshot on to the
clipboard, so you'll then need to paste it into paint or other such
graphics program (PSP, Photoshop) after which you'll then be able to
save it to a file.
--
* Rodolfo De Nadai *
* Analista de Sistema Jr. - Desenvolvimento *
*Informática de Municípios Associados S.A.*
Seu governo mais inteligente
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> -
www.ima.sp.gov.br <http://www.ima.sp.gov.br/>
Fone: (19) 3739-6000 / Ramal: 1307
--- End Message ---
--- Begin Message ---
>
> If you're not talking about automated screenshots, and you're using
> Windows, just press your "PrtScr" button. Hold down Alt as well to get
> just the active window. This will put the screenshot on to the
> clipboard, so you'll then need to paste it into paint or other such
> graphics program (PSP, Photoshop) after which you'll then be able to
> save it to a file.
Thanks for the "Alt" tip. I always hated Windoze b/c I couldn't just select
part of the screen.... show how little I knew!
Sorry that this had nothing to do with the original post. =/
~PT
--- End Message ---
--- Begin Message ---
Philip Thompson wrote:
If you're not talking about automated screenshots, and you're using
Windows, just press your "PrtScr" button. Hold down Alt as well to get
just the active window. This will put the screenshot on to the
clipboard, so you'll then need to paste it into paint or other such
graphics program (PSP, Photoshop) after which you'll then be able to
save it to a file.
Thanks for the "Alt" tip. I always hated Windoze b/c I couldn't just select
part of the screen.... show how little I knew!
Sorry that this had nothing to do with the original post. =/
http://www.jingproject.com/ is also worth a look if you take screenshots
a lot or ever want to share short screencasts.
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
Here are php functions that you are looking for... long time ago i found
this, but can't remenber anymore the functions names, but i know that
was possible!!!... so a search google again and give me:
http://blog.thepimp.net/index.php/post/2007/04/17/Screen-capture-with-PHP-and-GD
But here the references on php documentation:
http://php.oregonstate.edu/manual/en/function.imagegrabscreen.php
http://us3.php.net/manual/en/function.imagegrabwindow.php
Stut escreveu:
Philip Thompson wrote:
If you're not talking about automated screenshots, and you're using
Windows, just press your "PrtScr" button. Hold down Alt as well to get
just the active window. This will put the screenshot on to the
clipboard, so you'll then need to paste it into paint or other such
graphics program (PSP, Photoshop) after which you'll then be able to
save it to a file.
Thanks for the "Alt" tip. I always hated Windoze b/c I couldn't just
select
part of the screen.... show how little I knew!
Sorry that this had nothing to do with the original post. =/
http://www.jingproject.com/ is also worth a look if you take
screenshots a lot or ever want to share short screencasts.
-Stut
--
* Rodolfo De Nadai *
* Analista de Sistema Jr. - Desenvolvimento *
*Informática de Municípios Associados S.A.*
Seu governo mais inteligente
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> -
www.ima.sp.gov.br <http://www.ima.sp.gov.br/>
Fone: (19) 3739-6000 / Ramal: 1307
--- End Message ---
--- Begin Message ---
I recommed you Codelobster php edition. Very good free php editor.
It reminds me a mix of Zend Studio and MS Visual Studio. If to the basic
features they are:
syntax highlighting, an intelligent outocomplete, step by step debugger,
help on php, html, mysql; jump
to funtion's or class's declaration in the project; search within the
project; highlighting of paired tags and brackets; Calss View.
I like that it has small size - only 5 mb. Free.
I've downloaded from:
http://www.codelobster.com
Good luck!
--
View this message in context:
http://www.nabble.com/Which-PHP-Editor-to-use--tf4207185.html#a13231686
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
2007. 10. 16, kedd keltezéssel 04.59-kor mooor ezt írta:
>
> I recommed you Codelobster php edition. Very good free php editor.
>
> It reminds me a mix of Zend Studio and MS Visual Studio. If to the basic
> features they are:
>
> syntax highlighting, an intelligent outocomplete, step by step debugger,
> help on php, html, mysql; jump
>
> to funtion's or class's declaration in the project; search within the
> project; highlighting of paired tags and brackets; Calss View.
>
> I like that it has small size - only 5 mb. Free.
>
> I've downloaded from:
> http://www.codelobster.com
> Good luck!
>
>
wow I haven't seen that thread for several weeks. this is really thread
resurrection lol :)
anyway, this thread has been talked to death a million times, so we
could just let it drop finally (I thought we already did it...) ;)
greets,
Zoltán Németh
> --
> View this message in context:
> http://www.nabble.com/Which-PHP-Editor-to-use--tf4207185.html#a13231686
> Sent from the PHP - General mailing list archive at Nabble.com.
>
--- End Message ---
--- Begin Message ---
Zoltán Németh wrote:
2007. 10. 16, kedd keltezéssel 04.59-kor mooor ezt írta:
I recommed you Codelobster php edition. Very good free php editor.
It reminds me a mix of Zend Studio and MS Visual Studio. If to the basic
features they are:
syntax highlighting, an intelligent outocomplete, step by step debugger,
help on php, html, mysql; jump
to funtion's or class's declaration in the project; search within the
project; highlighting of paired tags and brackets; Calss View.
I like that it has small size - only 5 mb. Free.
I've downloaded from:
http://www.codelobster.com
Good luck!
wow I haven't seen that thread for several weeks. this is really thread
resurrection lol :)
anyway, this thread has been talked to death a million times, so we
could just let it drop finally (I thought we already did it...) ;)
Nahh. I wanna hear more about the "Drug and Drop function for loading a
new file". Cause everyone knows that for best results you've gotta drug
files before you drop them into an application.
http://www.codelobster.com/details_phped.html (end of page)
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
On 10/16/07, Stut <[EMAIL PROTECTED]> wrote:
>
> Zoltán Németh wrote:
> > 2007. 10. 16, kedd keltezéssel 04.59-kor mooor ezt írta:
> >>
> >> I recommed you Codelobster php edition. Very good free php
> editor.
> >>
> >> It reminds me a mix of Zend Studio and MS Visual Studio. If to the
> basic
> >> features they are:
> >>
> >> syntax highlighting, an intelligent outocomplete, step by step
> debugger,
> >> help on php, html, mysql; jump
> >>
> >> to funtion's or class's declaration in the project; search within the
> >> project; highlighting of paired tags and brackets; Calss View.
> >>
> >> I like that it has small size - only 5 mb. Free.
> >>
> >> I've downloaded from:
> >> http://www.codelobster.com
> >> Good luck!
> >>
> >>
> >
> > wow I haven't seen that thread for several weeks. this is really thread
> > resurrection lol :)
> >
> > anyway, this thread has been talked to death a million times, so we
> > could just let it drop finally (I thought we already did it...) ;)
>
> Nahh. I wanna hear more about the "Drug and Drop function for loading a
> new file". Cause everyone knows that for best results you've gotta drug
> files before you drop them into an application.
>
> http://www.codelobster.com/details_phped.html (end of page)
>
> -Stut
>
>
Outta curiosity... is this a legit piece of software? I went to the site and
it *looks* real.... but we all know how looks can be. =P I wasn't interested
in downloading a virus this morning..... any takers? =D
~Philip
--- End Message ---
--- Begin Message ---
Ahh, so you're one of those running with out anti-virus! ... now we know
why there is so much spam :P
j/k, its legit.
Marek
Philip Thompson wrote:
>
> Outta curiosity... is this a legit piece of software? I went to the site and
> it *looks* real.... but we all know how looks can be. =P I wasn't interested
> in downloading a virus this morning..... any takers? =D
>
> ~Philip
>
>
--- End Message ---
--- Begin Message ---
In the same boat here...waiting for a guinea pig to ok it
Bastien> Date: Tue, 16 Oct 2007 08:56:16 -0500> From: [EMAIL PROTECTED]> To:
[EMAIL PROTECTED]> Subject: Re: [PHP] Which PHP-Editor to use?> > On 10/16/07,
Stut <[EMAIL PROTECTED]> wrote:> >> > Zoltán Németh wrote:> > > 2007. 10. 16,
kedd keltezéssel 04.59-kor mooor ezt írta:> > >>> > >> I recommed you
Codelobster php edition. Very good free php> > editor.> > >>> > >> It reminds
me a mix of Zend Studio and MS Visual Studio. If to the> > basic> > >> features
they are:> > >>> > >> syntax highlighting, an intelligent outocomplete, step by
step> > debugger,> > >> help on php, html, mysql; jump> > >>> > >> to funtion's
or class's declaration in the project; search within the> > >> project;
highlighting of paired tags and brackets; Calss View.> > >>> > >> I like that
it has small size - only 5 mb. Free.> > >>> > >> I've downloaded from:> > >>
http://www.codelobster.com> > >> Good luck!> > >>> > >>> > >> > > wow I haven't
seen that thread for several weeks. this is really thread> > > resurrection lol
:)> > >> > > anyway, this thread has been talked to death a million times, so
we> > > could just let it drop finally (I thought we already did it...) ;)> >>
> Nahh. I wanna hear more about the "Drug and Drop function for loading a> >
new file". Cause everyone knows that for best results you've gotta drug> >
files before you drop them into an application.> >> >
http://www.codelobster.com/details_phped.html (end of page)> >> > -Stut> >> >>
Outta curiosity... is this a legit piece of software? I went to the site and>
it *looks* real.... but we all know how looks can be. =P I wasn't interested>
in downloading a virus this morning..... any takers? =D> > ~Philip
_________________________________________________________________
Express yourself with free Messenger emoticons. Get them today!
http://www.freemessengeremoticons.ca/?icid=EMENCA122
--- End Message ---
--- Begin Message ---
That is why I believe in a "disposable system"
I have 2 main computers, one running XP and the other running Ubuntu Linux.
I make regular backups to secure server online via FTP and regularly burn
backups to CD. At any time if I got a virus that was by some (small) chance
powerful enough to cause damage to my PC that could not easily be cleaned up
- I would simply reformat the HD and reinstall the OS ;) (and that process
of reformatting and reinstalling takes a mere 30 minutes to 2 hours - latter
being the Windows and former being Ubuntu)
-Matt
On 10/16/07, Bastien Koert <[EMAIL PROTECTED]> wrote:
>
>
> In the same boat here...waiting for a guinea pig to ok it
>
> Bastien> Date: Tue, 16 Oct 2007 08:56:16 -0500> From:
> [EMAIL PROTECTED]> To: [EMAIL PROTECTED]> Subject: Re: [PHP]
> Which PHP-Editor to use?> > On 10/16/07, Stut <[EMAIL PROTECTED]> wrote:>
> >> > Zoltán Németh wrote:> > > 2007. 10. 16, kedd keltezéssel 04.59-kormooor
> >> > ezt írta:> > >>> > >> I recommed you Codelobster php edition. Very
> good free php> > editor.> > >>> > >> It reminds me a mix of Zend Studio and
> MS Visual Studio. If to the> > basic> > >> features they are:> > >>> > >>
> syntax highlighting, an intelligent outocomplete, step by step> > debugger,>
> > >> help on php, html, mysql; jump> > >>> > >> to funtion's or class's
> declaration in the project; search within the> > >> project; highlighting of
> paired tags and brackets; Calss View.> > >>> > >> I like that it has small
> size - only 5 mb. Free.> > >>> > >> I've downloaded from:> > >>
> http://www.codelobster.com> > >> Good luck!> > >>> > >>> > >> > > wow I
> haven't seen that thread for several weeks. this is really thread> > >
> resurrection lol :)> > >> > > anyway, this thread has been talked to death a
> million times, so we> > > could just let it drop finally (I thought we
> already did it...) ;)> >> > Nahh. I wanna hear more about the "Drug and Drop
> function for loading a> > new file". Cause everyone knows that for best
> results you've gotta drug> > files before you drop them into an
> application.> >> > http://www.codelobster.com/details_phped.html (end of
> page)> >> > -Stut> >> >> Outta curiosity... is this a legit piece of
> software? I went to the site and> it *looks* real.... but we all know how
> looks can be. =P I wasn't interested> in downloading a virus this
> morning..... any takers? =D> > ~Philip
> _________________________________________________________________
> Express yourself with free Messenger emoticons. Get them today!
> http://www.freemessengeremoticons.ca/?icid=EMENCA122
--
-Matt Livingston
--- End Message ---
--- Begin Message ---
Stut wrote:
Zoltán Németh wrote:
2007. 10. 16, kedd keltezéssel 04.59-kor mooor ezt írta:
I recommed you Codelobster php edition. Very good free php
editor.
It reminds me a mix of Zend Studio and MS Visual Studio. If to
the basic
features they are:
syntax highlighting, an intelligent outocomplete, step by step
debugger,
help on php, html, mysql; jump
to funtion's or class's declaration in the project; search within the
project; highlighting of paired tags and brackets; Calss View.
I like that it has small size - only 5 mb. Free.
I've downloaded from:
http://www.codelobster.com
Good luck!
wow I haven't seen that thread for several weeks. this is really thread
resurrection lol :)
anyway, this thread has been talked to death a million times, so we
could just let it drop finally (I thought we already did it...) ;)
Nahh. I wanna hear more about the "Drug and Drop function for loading
a new file". Cause everyone knows that for best results you've gotta
drug files before you drop them into an application.
http://www.codelobster.com/details_phped.html (end of page)
-Stut
I thought it was you had to drug the programmers so they can handle the
insanity of the clients that have no idea how anything works and expect
you to deliver the world on a silver plater while never paying more then
$99 for the project.
--- End Message ---
--- Begin Message ---
Hi. Is it possible to dynamically find where PHP is installed on a Win 2k3
machine running IIS? I am setting up a configuration page and I want to show
where the install is - not change, just show. I have looked at phpinfo and
$_SERVER information, but none of the information seems to jump straight out
and tell me. I've Google'd and searched the PHP site, but to no avail.
Suggestions?
Thanks,
~Philip
--- End Message ---
--- Begin Message ---
On 10/16/07, Andrew Peterson <[EMAIL PROTECTED]> wrote:
>
> Hi Phill,
>
> Try using http://us2.php.net/ini_get_all or http://us2.php.net/ini_get
>
> On 10/16/07, Philip Thompson <[EMAIL PROTECTED]> wrote:
> >
> > Hi. Is it possible to dynamically find where PHP is installed on a Win
> > 2k3
> > machine running IIS? I am setting up a configuration page and I want to
> > show
> > where the install is - not change, just show. I have looked at phpinfo
> > and
> > $_SERVER information, but none of the information seems to jump straight
> > out
> > and tell me. I've Google'd and searched the PHP site, but to no avail.
> > Suggestions?
> >
> > Thanks,
> > ~Philip
>
>
Using these functions would only be useful if the installation directory
were listed in the ini settings (phpinfo). Unfortunately, the installation
directory is not listed there... well not on mine anyway. =/ Any other
thoughts?
~Philip
--- End Message ---
--- Begin Message ---
Hi list!
I read data from 2 databases and for the purpose of displaying the
information at my web interface as one piece
I need to combine the data into one array first.. Here is my problem:
Firstly, it reads from first DB and get this array: (it's a sum of
server names in table)
arrayDB1 = array(array('8', 'SER'), array('5','Asterisk'))
When finished then it starts reading from second DB
where I would get
arrayDB2 = array(array('6', 'XIP'), array('4','Asterisk'))
Is there any function where I would get
result = array(array('8', 'SER'), array('9','Asterisk'), array('6','XIP'))
Probably, it would be best to add number of Asterisk while cycling
through data of second DB.
The problem could be when databases have thousands of rows in each DB.
I'm just asking in case you know a better approach.
Thank you,
Lada
--- End Message ---
--- Begin Message ---
array_merge() function?
If your db is MySQL, look at this thread, Google being your friend:
http://lists.mysql.com/mysql/204616
Cheers - Milesx
On 10/16/07, Ladislav Andel <[EMAIL PROTECTED]> wrote:
>
> Hi list!
> I read data from 2 databases and for the purpose of displaying the
> information at my web interface as one piece
> I need to combine the data into one array first.. Here is my problem:
>
> Firstly, it reads from first DB and get this array: (it's a sum of
> server names in table)
>
> arrayDB1 = array(array('8', 'SER'), array('5','Asterisk'))
>
> When finished then it starts reading from second DB
> where I would get
>
> arrayDB2 = array(array('6', 'XIP'), array('4','Asterisk'))
>
>
> Is there any function where I would get
> result = array(array('8', 'SER'), array('9','Asterisk'),
> array('6','XIP'))
>
> Probably, it would be best to add number of Asterisk while cycling
> through data of second DB.
> The problem could be when databases have thousands of rows in each DB.
>
> I'm just asking in case you know a better approach.
>
> Thank you,
> Lada
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Miles Thompson wrote:
array_merge() function?
If your db is MySQL, look at this thread, Google being your friend:
http://lists.mysql.com/mysql/204616
Thanks for quick reply.
Array_merge doesn't do what I want.
And also those databases are at different locations.. Not the same machines.
I found something here http://www.linux.com/articles/52390
but not sure if it is what I want but will read up.
Thanks,
Lada
Cheers - Milesx
On 10/16/07, Ladislav Andel <[EMAIL PROTECTED]> wrote:
Hi list!
I read data from 2 databases and for the purpose of displaying the
information at my web interface as one piece
I need to combine the data into one array first.. Here is my problem:
Firstly, it reads from first DB and get this array: (it's a sum of
server names in table)
arrayDB1 = array(array('8', 'SER'), array('5','Asterisk'))
When finished then it starts reading from second DB
where I would get
arrayDB2 = array(array('6', 'XIP'), array('4','Asterisk'))
Is there any function where I would get
result = array(array('8', 'SER'), array('9','Asterisk'),
array('6','XIP'))
Probably, it would be best to add number of Asterisk while cycling
through data of second DB.
The problem could be when databases have thousands of rows in each DB.
I'm just asking in case you know a better approach.
Thank you,
Lada
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Ladislav Andel wrote:
Miles Thompson wrote:
array_merge() function?
If your db is MySQL, look at this thread, Google being your friend:
http://lists.mysql.com/mysql/204616
Thanks for quick reply.
Array_merge doesn't do what I want.
And also those databases are at different locations.. Not the same
machines.
I found something here http://www.linux.com/articles/52390
but not sure if it is what I want but will read up.
This is not what I'm looking for either.. (replicating).
Data at each database are mostly different.
Thanks,
Lada
Cheers - Milesx
On 10/16/07, Ladislav Andel <[EMAIL PROTECTED]> wrote:
Hi list!
I read data from 2 databases and for the purpose of displaying the
information at my web interface as one piece
I need to combine the data into one array first.. Here is my problem:
Firstly, it reads from first DB and get this array: (it's a sum of
server names in table)
arrayDB1 = array(array('8', 'SER'), array('5','Asterisk'))
When finished then it starts reading from second DB
where I would get
arrayDB2 = array(array('6', 'XIP'), array('4','Asterisk'))
Is there any function where I would get
result = array(array('8', 'SER'), array('9','Asterisk'),
array('6','XIP'))
Probably, it would be best to add number of Asterisk while cycling
through data of second DB.
The problem could be when databases have thousands of rows in each DB.
I'm just asking in case you know a better approach.
Thank you,
Lada
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Tue, 2007-10-16 at 16:42 +0200, Ladislav Andel wrote:
> arrayDB1 = array(array('8', 'SER'), array('5','Asterisk'))
>
> When finished then it starts reading from second DB
> where I would get
>
> arrayDB2 = array(array('6', 'XIP'), array('4','Asterisk'))
>
>
> Is there any function where I would get
> result = array(array('8', 'SER'), array('9','Asterisk'), array('6','XIP'))
>
You could try something like:
$result[] = $arrayDB1;
$result[] .= $arrayDB2;
If I understand the question correctly.
--Paul
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm
--- End Message ---
--- Begin Message ---
On Tue, 16 Oct 2007, Paul Scott wrote:
> You could try something like:
>
> $result[] = $arrayDB1;
> $result[] .= $arrayDB2;
That .= doesn't do what you think it does when used with arrays.
--
Greg Donald
Cyberfusion Consulting
http://cyberfusionconsulting.com/
--- End Message ---
--- Begin Message ---
On 10/16/07, Greg Donald <[EMAIL PROTECTED]> wrote:
>
> On Tue, 16 Oct 2007, Paul Scott wrote:
> > You could try something like:
> >
> > $result[] = $arrayDB1;
> > $result[] .= $arrayDB2;
>
> That .= doesn't do what you think it does when used with arrays.
Take this same concept (of creating a new array) and see if you can use
array_merge. I know you mentioned earlier that it wasn't what you were
looking for... however, maybe the combination will work???
Good luck,
~Philip
--- End Message ---
--- Begin Message ---
On 10/16/07, Ladislav Andel <[EMAIL PROTECTED]> wrote:
> Hi list!
> I read data from 2 databases and for the purpose of displaying the
> information at my web interface as one piece
> I need to combine the data into one array first.. Here is my problem:
>
> Firstly, it reads from first DB and get this array: (it's a sum of
> server names in table)
>
> arrayDB1 = array(array('8', 'SER'), array('5','Asterisk'))
>
> When finished then it starts reading from second DB
> where I would get
>
> arrayDB2 = array(array('6', 'XIP'), array('4','Asterisk'))
>
>
> Is there any function where I would get
> result = array(array('8', 'SER'), array('9','Asterisk'), array('6','XIP'))
If you have to have data manipulation when combining the arrays (such
as adding the two separate values for "Asterisk" as per your example),
then there isn't a pre-defined function to do what you want. I'd
change the arrangement of your arrays a bit, so that they looked
something like the following (very untested):
$arrDB1 = array('Asterisk' => 5, 'SER' => 8);
$arrDB2 = array('Asterisk' => 4, 'SER' => 6);
function addArrays($arr1, $arr2)
{
$res = array();
if (is_array($arr1) and is_array($arr2))
{
$keys = array_merge(array_keys($arr1), array_keys($arr2));
foreach ($keys as $key)
{
$res["$key"] = $arr1["$key"] + $arr2["$key"]; //May have to
check isset of each $arrX["$key"] before addition, not sure
}
} else
{
//Do appropriate error handling here...
}
return $res;
}
>
> Probably, it would be best to add number of Asterisk while cycling
> through data of second DB.
> The problem could be when databases have thousands of rows in each DB.
>
> I'm just asking in case you know a better approach.
>
> Thank you,
> Lada
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
nope, merge is not doing what I want and also using FEDERATED
<http://localhost/phpmyadmin/server_engines.php?engine=FEDERATED&token=d18a0e0de85e891b3558f84f6585994f>
engine in mysql I think is not the simplest way to go or even not
appropriate.
Anyhow, I did it an ugly way ( tablearray follows DB queries with the
same fields; one row of a query is e.g.
count=5, server_name="Asterisk" )
Variable dbs is an array with MySQL URIs.
Lada
function get_data($dbs, $tablearray, $query) {
$id = 0;
$result = array();
$records = 0;
$db_select = 0;
for ($c = 0; $c < $len; $c++) {
$db =& DB::Connect( $dbs[$db_select] );
if (PEAR::isError($db)) { echo "Can't connect to
DB".$db_select."<br>"; }
else {
$res = $db->query($query, array() );
while( $res->fetchInto( $row ) ) {
$cols = count($row);
if ($db_select > 0) {
for ($i=0; $i < $records; $i++) {
if (in_array($row[1],$result[$i])) {
$result[$i][$tablearray[0]] = $row[0] +
$result[$i][$tablearray[0]];
break;
}
else {
if ([EMAIL PROTECTED]) {
@$entered = True;
for ($b=0; $b<$cols; $b++) {
$result[$id][$tablearray[$b]] =
$row[$b];
}
$id++;
}
}
}
@$entered = False;
}
else {
for ($i=0; $i<$cols; $i++) {
$result[$id][$tablearray[$i]] = $row[$i];
}
$id++;
}
}
}
$db_select++;
$records = count($result);
return $result;
}
Philip Thompson wrote:
On 10/16/07, Greg Donald <[EMAIL PROTECTED]> wrote:
On Tue, 16 Oct 2007, Paul Scott wrote:
You could try something like:
$result[] = $arrayDB1;
$result[] .= $arrayDB2;
That .= doesn't do what you think it does when used with arrays.
Take this same concept (of creating a new array) and see if you can use
array_merge. I know you mentioned earlier that it wasn't what you were
looking for... however, maybe the combination will work???
Good luck,
~Philip
--- End Message ---
--- Begin Message ---
Thank you very much!
It's exactly the code I was looking for!
Lada
PS: my previous ungly code is half long now :)
James Ausmus wrote:
On 10/16/07, Ladislav Andel <[EMAIL PROTECTED]> wrote:
Hi list!
I read data from 2 databases and for the purpose of displaying the
information at my web interface as one piece
I need to combine the data into one array first.. Here is my problem:
Firstly, it reads from first DB and get this array: (it's a sum of
server names in table)
arrayDB1 = array(array('8', 'SER'), array('5','Asterisk'))
When finished then it starts reading from second DB
where I would get
arrayDB2 = array(array('6', 'XIP'), array('4','Asterisk'))
Is there any function where I would get
result = array(array('8', 'SER'), array('9','Asterisk'), array('6','XIP'))
If you have to have data manipulation when combining the arrays (such
as adding the two separate values for "Asterisk" as per your example),
then there isn't a pre-defined function to do what you want. I'd
change the arrangement of your arrays a bit, so that they looked
something like the following (very untested):
$arrDB1 = array('Asterisk' => 5, 'SER' => 8);
$arrDB2 = array('Asterisk' => 4, 'SER' => 6);
function addArrays($arr1, $arr2)
{
$res = array();
if (is_array($arr1) and is_array($arr2))
{
$keys = array_merge(array_keys($arr1), array_keys($arr2));
foreach ($keys as $key)
{
$res["$key"] = $arr1["$key"] + $arr2["$key"]; //May have to
check isset of each $arrX["$key"] before addition, not sure
}
} else
{
//Do appropriate error handling here...
}
return $res;
}
Probably, it would be best to add number of Asterisk while cycling
through data of second DB.
The problem could be when databases have thousands of rows in each DB.
I'm just asking in case you know a better approach.
Thank you,
Lada
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Ladislav Andel [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 16, 2007 1:05 PM
> To: James Ausmus; PHP List
> Subject: Re: [PHP] combining 2 arrays
>
> Thank you very much!
> It's exactly the code I was looking for!
>
> Lada
> PS: my previous ungly code is half long now :)
>
> James Ausmus wrote:
> > On 10/16/07, Ladislav Andel <[EMAIL PROTECTED]> wrote:
> >
> >> Hi list!
> >> I read data from 2 databases and for the purpose of displaying the
> >> information at my web interface as one piece
> >> I need to combine the data into one array first.. Here is
> my problem:
> >>
> >> Firstly, it reads from first DB and get this array: (it's a sum of
> >> server names in table)
> >>
> >> arrayDB1 = array(array('8', 'SER'), array('5','Asterisk'))
> >>
> >> When finished then it starts reading from second DB
> >> where I would get
> >>
> >> arrayDB2 = array(array('6', 'XIP'), array('4','Asterisk'))
> >>
> >>
> >> Is there any function where I would get
> >> result = array(array('8', 'SER'), array('9','Asterisk'),
> array('6','XIP'))
> >>
> >
> > If you have to have data manipulation when combining the
> arrays (such
> > as adding the two separate values for "Asterisk" as per
> your example),
> > then there isn't a pre-defined function to do what you want. I'd
> > change the arrangement of your arrays a bit, so that they looked
> > something like the following (very untested):
> >
> > $arrDB1 = array('Asterisk' => 5, 'SER' => 8);
> > $arrDB2 = array('Asterisk' => 4, 'SER' => 6);
> >
> > function addArrays($arr1, $arr2)
> > {
> > $res = array();
> >
> > if (is_array($arr1) and is_array($arr2))
> > {
> > $keys = array_merge(array_keys($arr1), array_keys($arr2));
> > foreach ($keys as $key)
> > {
> > $res["$key"] = $arr1["$key"] + $arr2["$key"]; //May have to
> > check isset of each $arrX["$key"] before addition, not sure
> > }
> > } else
> > {
> > //Do appropriate error handling here...
> > }
> > return $res;
> > }
> >
> >
> >
> >
> >> Probably, it would be best to add number of Asterisk while cycling
> >> through data of second DB.
> >> The problem could be when databases have thousands of rows
> in each DB.
> >>
> >> I'm just asking in case you know a better approach.
> >>
> >> Thank you,
> >> Lada
Wouldn't this work?
http://us2.php.net/manual/ro/function.array-merge.php
http://us2.php.net/manual/ro/function.array-merge-recursive.php
Also, you don't need to do (and shouldn't do):
$arr1["$key"]
Just make it
$arr1[$key]
No " marks. The quotes are a waste of time and will slow down your script if
you have many rows.
--- End Message ---
--- Begin Message ---
Array merge won't work as he needs to add the numerical values
involved, not just merge the arrays - there are overlap on the text
values, and any overlap needs to result in a val1 + val2.
-James
On 10/16/07, Daevid Vincent <[EMAIL PROTECTED]> wrote:
> > -----Original Message-----
> > From: Ladislav Andel [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, October 16, 2007 1:05 PM
> > To: James Ausmus; PHP List
> > Subject: Re: [PHP] combining 2 arrays
> >
> > Thank you very much!
> > It's exactly the code I was looking for!
> >
> > Lada
> > PS: my previous ungly code is half long now :)
> >
> > James Ausmus wrote:
> > > On 10/16/07, Ladislav Andel <[EMAIL PROTECTED]> wrote:
> > >
> > >> Hi list!
> > >> I read data from 2 databases and for the purpose of displaying the
> > >> information at my web interface as one piece
> > >> I need to combine the data into one array first.. Here is
> > my problem:
> > >>
> > >> Firstly, it reads from first DB and get this array: (it's a sum of
> > >> server names in table)
> > >>
> > >> arrayDB1 = array(array('8', 'SER'), array('5','Asterisk'))
> > >>
> > >> When finished then it starts reading from second DB
> > >> where I would get
> > >>
> > >> arrayDB2 = array(array('6', 'XIP'), array('4','Asterisk'))
> > >>
> > >>
> > >> Is there any function where I would get
> > >> result = array(array('8', 'SER'), array('9','Asterisk'),
> > array('6','XIP'))
> > >>
> > >
> > > If you have to have data manipulation when combining the
> > arrays (such
> > > as adding the two separate values for "Asterisk" as per
> > your example),
> > > then there isn't a pre-defined function to do what you want. I'd
> > > change the arrangement of your arrays a bit, so that they looked
> > > something like the following (very untested):
> > >
> > > $arrDB1 = array('Asterisk' => 5, 'SER' => 8);
> > > $arrDB2 = array('Asterisk' => 4, 'SER' => 6);
> > >
> > > function addArrays($arr1, $arr2)
> > > {
> > > $res = array();
> > >
> > > if (is_array($arr1) and is_array($arr2))
> > > {
> > > $keys = array_merge(array_keys($arr1), array_keys($arr2));
> > > foreach ($keys as $key)
> > > {
> > > $res["$key"] = $arr1["$key"] + $arr2["$key"]; //May have to
> > > check isset of each $arrX["$key"] before addition, not sure
> > > }
> > > } else
> > > {
> > > //Do appropriate error handling here...
> > > }
> > > return $res;
> > > }
> > >
> > >
> > >
> > >
> > >> Probably, it would be best to add number of Asterisk while cycling
> > >> through data of second DB.
> > >> The problem could be when databases have thousands of rows
> > in each DB.
> > >>
> > >> I'm just asking in case you know a better approach.
> > >>
> > >> Thank you,
> > >> Lada
>
> Wouldn't this work?
> http://us2.php.net/manual/ro/function.array-merge.php
> http://us2.php.net/manual/ro/function.array-merge-recursive.php
>
> Also, you don't need to do (and shouldn't do):
>
> $arr1["$key"]
>
> Just make it
>
> $arr1[$key]
>
> No " marks. The quotes are a waste of time and will slow down your script if
> you have many rows.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
I am programming a form this morning. I don't understand arrays really well.
I think this is what I am needing to use, but I am really not sure.
I have a PHP script that checks a POP e-mail address and is suppose to take the
incoming message and save it to a mySQL table based on the subject line. Every
now and then the subject line is broken with something like a <br /> and so I
have a handful of messages that need to be indexed manually. IE my script
can't see a "Subject: Correspondence for message 123" --- it is being received
as "Subject: Correspondence for <br />message 123" I am trying to update the
mySQL table with a form instead of continuing to use phpmyadmin to do these
updates. That is the background for my current project.
What I am wanting to do in my form is call up all the incoming messages that
have a message value of 0 (where they weren't automatically indexed) and I can
read through the incoming message to see what their reference number is and
type it in the field that I have called
"new_correspondence_received". An example of my HTML code is below.
Where I am getting stuck is I have more than 1 message that wasn't indexed
automatically I am not sure how to retrieve the values of:
correspondence_reference and new_correspondence_reference. (The only reason I
am displaying correspondence_received is to look for the reference number) Can
what I am trying to do be accomplished through an array to find out the values
submitted? How do you make array variables? What changes need to be made to
my form so I can find out the values being submitted?
Each message received that isn't automatically index is dispayed through this
form, one <TR></TR> per message. I know the mysql commands to update the
table, I just need help to retrieve the form variable values. Thanks for your
help. Ron
<tr><td width=200>
<font face="times new roman">
<center>
<input id=all type="checkbox" name="correspondence_reference" value="172"
checked>
172
</center>
</td><td width=200>
<font face="times new roman">
<center>
<input type=text name="new_correspondence_reference" size=6 maxlength=30 value
= "0">
</center>
</td><td width=400>
<textarea COLS=50 ROWS=10 name="correspondence_received">Message
here</textarea>
</td></tr>
--- End Message ---
--- Begin Message ---
On 10/16/07, ron.php <[EMAIL PROTECTED]> wrote:
>
> I am programming a form this morning. I don't understand arrays really
> well. I think this is what I am needing to use, but I am really not sure.
>
> I have a PHP script that checks a POP e-mail address and is suppose to
> take the incoming message and save it to a mySQL table based on the subject
> line. Every now and then the subject line is broken with something like a
> <br /> and so I have a handful of messages that need to be indexed manually.
> IE my script can't see a "Subject: Correspondence for message 123" --- it is
> being received as "Subject: Correspondence for <br />message 123" I am
> trying to update the mySQL table with a form instead of continuing to use
> phpmyadmin to do these updates. That is the background for my current
> project.
You can strip the <br/> from the string using:
$string = str_replace ('<br/>', '', $string);
What I am wanting to do in my form is call up all the incoming messages that
> have a message value of 0(where they weren't automatically indexed) and I
> can read through the incoming message to see what their reference number is
> and type it in the field that I have called
> "new_correspondence_received". An example of my HTML code is below.
>
> Where I am getting stuck is I have more than 1 message that wasn't indexed
> automatically I am not sure how to retrieve the values of:
> correspondence_referenceand new_correspondence_reference. (The only reason I
> am displaying correspondence_received is to look for the reference number)
> Can what I am trying to do be accomplished through an array to find out the
> values submitted? How do you make array variables? What changes need to be
> made to my form so I can find out the values being submitted?
>
> Each message received that isn't automatically index is dispayed through
> this form, one <TR></TR> per message. I know the mysql commands to update
> the table, I just need help to retrieve the form variable values.Thanksfor
> your help. Ron
>
> <tr><td width=200>
> <font face="times new roman">
> <center>
> <input id=all type="checkbox" name="correspondence_reference" value="172"
> checked>
> 172
> </center>
> </td><td width=200>
> <font face="times new roman">
> <center>
> <input type=text name="new_correspondence_reference" size=6 maxlength=30
> value = "0">
> </center>
> </td><td width=400>
> <textarea COLS=50 ROWS=10 name="correspondence_received">Message
> here</textarea>
> </td></tr>
To make an array in an HTML form...
<input type="checkbox" name="correspondence_reference[172]" value="1"
checked /> 172
<input type="checkbox" name="correspondence_reference[173]" value="1" /> 172
<input type="checkbox" name="correspondence_reference[174]" value="1" /> 172
...
Do that for each reference value. Then, in your PHP when you're grabbing the
POST data, you can just loop through the array to see what's been "checked"
- actually, only the "checked" items will show in the array. So, let's say,
from above, the 172 and 174 checkboxes were checked, the POST array would
contain the following...
<?
foreach ($_POST['correspondence_reference'] as $index => $value) {
echo "$index => $value";
}
?>
// Output
172 => 1
174 => 1
It doesn't really matter what the "value" of the checkboxes are. As long as
you know the index, then you're good and you can use that information
appropriately. This is one approach. I know there are others though...
Good luck,
~Philip
--- End Message ---
--- Begin Message ---
Hi,
i must create gallery (pictures and videos) in php
The user must login to see only his personal files.
There is any tool doing this.
thanks
--
View this message in context:
http://www.nabble.com/php-gallery-for-pictures-and-videos-tf4638844.html#a13249060
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---