php-general Digest 10 Mar 2011 09:44:50 -0000 Issue 7219

Topics (messages 311747 through 311759):

Re: Help translating PHP5 code to PHP4.
        311747 by: Richard Quadling
        311754 by: Marc Guay

Re: Returning a recordset to a desktop app
        311748 by: Ken Watkins

Can´t upload files bigger than 50KB
        311749 by: Gotzon Astondoa
        311750 by: Jay Blanchard
        311751 by: Gotzon Astondoa
        311752 by: Adam Richardson
        311755 by: Jim Lucas
        311756 by: Gotzon Astondoa
        311757 by: Gotzon Astondoa

Need help debugging random httpd segfault
        311753 by: Phil

Re: Somewhat OT - Stored Procedures
        311758 by: Nathan Nobbe

Issue with Quick Email validation
        311759 by: robert.myself.com

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 ---
On 7 March 2011 17:29, Marc Guay <[email protected]> wrote:
> Hi Richard,
>
> It's not a SOAP service, and I've actually decided to have ask the
> client to upgrade their server software before continuing.  But for
> the sake of study:
>
>> Depending upon your requirement, you could use simplexml_load_string()  to 
>> convert an XML string into a native PHP object rather than manually parsing 
>> the text of the XML string.
>
> I looked up simplexml_load_string() and the manual seems to say that
> it's only available in PHP5.  Can you clarify?
>
> Marc

Ah. I see that you are trying to port TO V4 ...

(Yes, simplexml is PHP5+ only).

PHP4 is end of life and though I have my ZCE which was gained based
upon PHP4, I've not really used it for the last many years (looking
back it is probably 5 years or so).

Depending upon their hosting, I would recommend one of the following options.

1 - Upgrade to PHP 5.3.5
2 - Dual install PHP 5.3.5
3 - Create a new vhost with PHP 5.3.5

I'm guessing upgrading straight away is a no-no.

Running PHP4 and PHP5 SxS is very simple (I used to run PHP4 ISAPI,
PHP5 CGI and PHP6-dev CGI - on the same Sambar Server - on Windows
too!).

The ease I had in running multiple versions of PHP on Windows would
suggest it should be pretty easy to do for non-windows.

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--- End Message ---
--- Begin Message ---
> The ease I had in running multiple versions of PHP on Windows would
> suggest it should be pretty easy to do for non-windows.

Funny and true.  Thanks for the tips Richard, I've suggested that they
upgrade their hosting package.

Marc

--- End Message ---
--- Begin Message ---
On 3/7/2011 7:19 AM, Richard Quadling wrote:
> On 5 March 2011 13:48, Ken Watkins <[email protected]> wrote:
>> On 3/5/2011 4:30 AM, Richard Quadling wrote:
>>> On 4 March 2011 23:48, Ken Watkins <[email protected]> wrote:
>>>> Hi All.
>>>>
>>>> I have a Windows desktop app that I created using Visual Foxpro (a 
>>>> database app).
>>>> I want to write a PHP script that I will call from my desktop app. The 
>>>> script will simply
>>>> query a MySQL database on my web server and return the recordset to the 
>>>> desktop app.
>>>>
>>>> My question is simply this: What is the preferred method for passing this 
>>>> recordset back
>>>> to the desktop app? I'm assuming that there's no reasonable way to send a 
>>>> recordset back
>>>> without converting it to an array or XML or an object or something? How do 
>>>> I return the
>>>> data in the recordset to the desktop app?
>>>>
>>>> Thanks for your advice.
>>>> Ken Watkins
>>> In general terms, the output of a PHP script is going to be text
>>> (html, xml, csv, etc.) or binary (images).
>>>
>>> Getting a PHP script to communicate natively with FoxPro is not going
>>> to be trivial task. It MAY be able to be done, but hopefully FoxPro
>>> has the capability of running a PHP script via the command line ...
>>>
>>> C:\PHP5\php.exe -f script.php -- script_arg1 script_arg2
>>>
>>> PHP can either output the result set (in an appropriate form) directly
>>> and FoxPro could read it from STDIN (if it has that support) or PHP
>>> can write the answer to a file and FoxPro can use normal file and
>>> string functions to read the data.
>>>
>>> If FoxPro has XML support, then use it. It will be much cleaner in the
>>> long run if the data changes. If not, then a tab separated data file
>>> (rather than a CSV file). This assumes that your data does not contain
>>> tabs. If so, choose another separator.
>>>
>>> Richard.
>> Richard,
>>
>> Foxpro does have XML support, so you answered that part of my question, 
>> thanks.
>> And it is capable of calling any other executable on the local machine 
>> through the
>> local OS shell - which seems to be what you are advocating. But I'm not sure 
>> how
>> I would do that over the internet. I just discussed this issue with Larry, 
>> and I assume
>> that I would use HTTP? Or is there a way to call a command line script on a 
>> remote
>> web server without using HTTP?  Sorry if this is a stupid question.
>>
>> Thanks for your help!
>> Ken
> So, what you need to have is an HTTP Request from within FoxPro.
>
> http://www.example-code.com/foxpro/http_post_form.asp
>
> gives an example, but it seems to use a third party ActiveX component.
>
> If FoxPro can load any locally resident/installed ActiveX component,
> then maybe ...
>
> http://fox.wikis.com/wc.dll?Wiki~ReadUrl
>
> has better examples.
>
>
> So, using something from that to get the data (XML) and then using
> FoxPro's native support for XML and you should be on your way.
>
> But at this stage, I'd be looking to ask for further help in a FoxPro
> forum as this is really nothing to do with PHP.
>
> Good luck.
>
> Richard.
Richard,

Thanks for your comments. I ended up taking the simple approach - I installed 
an ODBC driver for MySQL and let Foxpro query the database directly from a 
remote workstation. I suppose that what I wanted to do originally was to 
introduce PHP into the mix just to have another option, and to gain more 
experience in PHP. Probably not a good idea anyway.

Thanks again for the help.
Ken Watkins

--- End Message ---
--- Begin Message ---
 Hi all:

On my website I have an Ajax form. From this form user can upload files.
Server side is a PHP script.
This form works properly on my development server.
But when I uploaded my application to the definitive server I discovered
that I can only upload files less than 50KB (It works perfectly with 1 to 20
KB images).
These are the data from the server configuration that I believe can affect:

     post_max_size 8M
     upload_max_filesize 2M
     memory_limit 128M
     safe_mode off
     SELinux disabled
     open_basedir none

I´m now making tests with 52KB image: image.jpg
I discovered that the uploaded file is uploaded to /tmp. This file name is
php10tfTp.
But the file is not completely uploaded! So, my PHP script is not fired!
The original image size is 52KB and the new file size is 35KB . I download
the tmp file and rename it to php10tfTp.jpg. I can see that half frame is
the same as the original and the other half is gray.

Any idea what is happening?

Thanks in advance.

--- End Message ---
--- Begin Message ---
[snip]
50KB
[/snip]

Have you checked the upload form itself for max_file_size?

--- End Message ---
--- Begin Message ---
Upload form is OK, I can upload 5MB files in development server.

2011/3/9 Jay Blanchard <[email protected]>

> [snip]
> 50KB
> [/snip]
>
> Have you checked the upload form itself for max_file_size?
>

--- End Message ---
--- Begin Message ---
Hi Gotzon,

I'm wondering if your javascript is timing out. On the development server,
is everything local so it's happening close to instantly? If so, it's
possible that the latency of your production environment is causing the
issue, as it's taking longer to process the request than the ajax script has
allotted. That could explain why a 20K upload would work and a 50K isn't.
50K isn't that big, but if the timeout was set to one or two seconds, I
suppose it's possible.

Adam

On Wed, Mar 9, 2011 at 10:02 AM, Gotzon Astondoa <[email protected]>wrote:

> Upload form is OK, I can upload 5MB files in development server.
>
> 2011/3/9 Jay Blanchard <[email protected]>
>
> > [snip]
> > 50KB
> > [/snip]
> >
> > Have you checked the upload form itself for max_file_size?
> >
>



-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

--- End Message ---
--- Begin Message ---
On 3/9/2011 6:28 AM, Gotzon Astondoa wrote:
>  Hi all:
> 
> On my website I have an Ajax form. From this form user can upload files.

My guess would be that you have an HTML form.  Not AJAX

> Server side is a PHP script.
> This form works properly on my development server.

Is this on localhost or is it remote too?

> But when I uploaded my application to the definitive server I discovered
> that I can only upload files less than 50KB (It works perfectly with 1 to 20
> KB images).

Silly question, how long does it take for these 1 to 20 KB files to upload?

> These are the data from the server configuration that I believe can affect:
> 
>      post_max_size 8M
>      upload_max_filesize 2M
>      memory_limit 128M
>      safe_mode off
>      SELinux disabled
>      open_basedir none
> 
> I´m now making tests with 52KB image: image.jpg
> I discovered that the uploaded file is uploaded to /tmp. This file name is
> php10tfTp.

how much space is free on the partition that contains /tmp  ?

> But the file is not completely uploaded! So, my PHP script is not fired!
> The original image size is 52KB and the new file size is 35KB . I download
> the tmp file and rename it to php10tfTp.jpg. I can see that half frame is
> the same as the original and the other half is gray.
> 
> Any idea what is happening?
> 
> Thanks in advance.
> 


--- End Message ---
--- Begin Message ---
Thank you for your interest Lucas.

2011/3/9 Jim Lucas <[email protected]>

> On 3/9/2011 6:28 AM, Gotzon Astondoa wrote:
> >  Hi all:
> >
> > On my website I have an Ajax form. From this form user can upload files.
>
> My guess would be that you have an HTML form.  Not AJAX
>
OK. The code is http://www.phpletter.com/Demo/Tinymce-Ajax-File-Manager/

>
> > Server side is a PHP script.
> > This form works properly on my development server.
>
> Is this on localhost or is it remote too?
>
Development is local,  production is remote.

>
> > But when I uploaded my application to the definitive server I discovered
> > that I can only upload files less than 50KB (It works perfectly with 1 to
> 20
> > KB images).
>
> Silly question, how long does it take for these 1 to 20 KB files to upload?
>
>
In all of the cases the time is the same (more or less), about 4,5 seconds.
I also do a test with a 35KB image and the time is the same, about 4,5
seconds


> > These are the data from the server configuration that I believe can
> affect:
> >
> >      post_max_size 8M
> >      upload_max_filesize 2M
> >      memory_limit 128M
> >      safe_mode off
> >      SELinux disabled
> >      open_basedir none
> >
> > I´m now making tests with 52KB image: image.jpg
> > I discovered that the uploaded file is uploaded to /tmp. This file name
> is
> > php10tfTp.
>
> how much space is free on the partition that contains /tmp  ?
>

About 16 GB


> > But the file is not completely uploaded! So, my PHP script is not fired!
> > The original image size is 52KB and the new file size is 35KB . I
> download
> > the tmp file and rename it to php10tfTp.jpg. I can see that half frame is
> > the same as the original and the other half is gray.
> >
> > Any idea what is happening?
> >
> > Thanks in advance.
> >
>
>

--- End Message ---
--- Begin Message ---
Hi Adam:

     I don´t understand well your point.
     I do some time tests (production environment) uploading files from 1KB
to 47 KB, in all of the cases the time is the same (more or less), about 4,5
seconds.
    The magic size is 48KB, can´t upload files bigger that this :-(

2011/3/9 Adam Richardson <[email protected]>

> Hi Gotzon,
>
> I'm wondering if your javascript is timing out. On the development server,
> is everything local so it's happening close to instantly? If so, it's
> possible that the latency of your production environment is causing the
> issue, as it's taking longer to process the request than the ajax script
> has
> allotted. That could explain why a 20K upload would work and a 50K isn't.
> 50K isn't that big, but if the timeout was set to one or two seconds, I
> suppose it's possible.
>
> Adam
>
> On Wed, Mar 9, 2011 at 10:02 AM, Gotzon Astondoa <[email protected]
> >wrote:
>
> > Upload form is OK, I can upload 5MB files in development server.
> >
> > 2011/3/9 Jay Blanchard <[email protected]>
> >
> > > [snip]
> > > 50KB
> > > [/snip]
> > >
> > > Have you checked the upload form itself for max_file_size?
> > >
> >
>
>
>
> --
> Nephtali:  A simple, flexible, fast, and security-focused PHP framework
> http://nephtaliproject.com
>

--- End Message ---
--- Begin Message ---
Hello list,

We've been experiencing random crashes on httpd, error_log shows a
bunch of [notice] child pid 12984 exit signal Segmentation fault (11)

PHP 5.2.17:

./configure --with-apxs2=/var/www/bin/apxs --with-gd
--with-jpeg-dir=/usr/local --with-pgsql --with-pdo-pgsql
--with-png-dir=/usr/local --with-zlib-dir=/usr/local --with-mssql
--enable-wddx --with-mysqli --with-freetype-dir=/usr/local
--enable-zend-multibyte --with-mcrypt --with-mysql --with-pdo-mysql
--enable-mbstring --with-pdo-dblib --with-sybase=/usr/local/freetds
--enable-soap --with-openssl --with-curl --with-imap --with-kerberos
--with-imap-ssl --enable-ftp --enable-debug

I've been looking at coredumps; here's what I got:

(gdb) bt
#0  zend_mm_remove_from_free_list (heap=0x85043f0, mm_block=0x8512420)
at /root/download/php/php-5.2.17/Zend/zend_alloc.c:837
#1  0x01042561 in _zend_mm_free_int (heap=0x85043f0, p=<value
optimized out>) at
/root/download/php/php-5.2.17/Zend/zend_alloc.c:1979
#2  0x0104f9c0 in _zval_dtor () at
/root/download/php/php-5.2.17/Zend/zend_variables.h:35
#3  _zval_ptr_dtor (zval_ptr=0x887af7c) at
/root/download/php/php-5.2.17/Zend/zend_execute_API.c:414
#4  0x0106682e in zend_hash_destroy (ht=0x86b43c8) at
/root/download/php/php-5.2.17/Zend/zend_hash.c:526
#5  0x01053a5d in destroy_zend_class (pce=0x8736aec) at
/root/download/php/php-5.2.17/Zend/zend_opcode.c:185
#6  0x0106682e in zend_hash_destroy (ht=0x85046b8) at
/root/download/php/php-5.2.17/Zend/zend_hash.c:526
#7  0x0105cc78 in zend_shutdown () at
/root/download/php/php-5.2.17/Zend/zend.c:736
#8  0x01019ba5 in php_module_shutdown () at
/root/download/php/php-5.2.17/main/main.c:1918
#9  0x01019c4b in php_module_shutdown_wrapper (sapi_globals=0x13724a0)
at /root/download/php/php-5.2.17/main/main.c:1889
#10 0x010c89e3 in php_apache_child_shutdown (tmp=0x0) at
/root/download/php/php-5.2.17/sapi/apache2handler/sapi_apache2.c:369
#11 0x009d3b69 in run_cleanups () at memory/unix/apr_pools.c:2306
#12 apr_pool_destroy (pool=0x867a1b0) at memory/unix/apr_pools.c:774
#13 0x080cbd54 in clean_child_exit (code=0) at prefork.c:196
#14 0x080cc49d in just_die (sig=15) at prefork.c:328
#15 <signal handler called>
#16 0x0052d424 in __kernel_vsyscall ()
#17 0x0028670b in poll () from /lib/libc.so.6
#18 0x009dda94 in apr_wait_for_io_or_timeout (f=0x0, s=0x867c1f8,
for_read=0) at support/unix/waitio.c:51
#19 0x009d7ada in apr_socket_sendv (sock=0x867c1f8, vec=0xbfe85340,
nvec=1, len=0xbfe85248) at network_io/unix/sendrecv.c:212
#20 0x0807b8a6 in writev_it_all (s=0x867c1f8, vec=0xbfe85338, nvec=2,
len=20851, nbytes=0xbfe853dc) at core_filters.c:321
#21 0x0807c42e in ap_core_output_filter (f=0x867c850, b=0x8686538) at
core_filters.c:868
#22 0x080afa28 in ap_http_header_filter (f=0x871ee70, b=0x8691a98) at
http_filters.c:1306
#23 0x08071f0e in ap_content_length_filter (f=0x871ee58, b=0x8691a98)
at protocol.c:1338
#24 0x080b1228 in ap_byterange_filter (f=0x871ee40, bb=0x8691a98) at
byterange_filter.c:169
#25 0x08092d42 in deflate_out_filter (f=0x8691a60, bb=0x8691a98) at
mod_deflate.c:512
#26 0x08092d42 in deflate_out_filter (f=0x8695050, bb=0x8691a98) at
mod_deflate.c:512
#27 0x00116edd in apr_brigade_write (b=0x8691a98, flush=0x8087640
<ap_filter_flush>, ctx=0x8695050,
    str=0x875e3bc "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\r\n<html
xmlns=\"http://www.w3.org/1999/xhtml\"; xml:lang=\"fr\"
lang=\"fr\">\r\n<head>\r\n<meta name=\""..., nbyte=20520) at
buckets/apr_brigade.c:429
#28 0x0806fe26 in buffer_output (r=0x8694278,
    str=0x875e3bc "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\r\n<html
xmlns=\"http://www.w3.org/1999/xhtml\"; xml:lang=\"fr\"
lang=\"fr\">\r\n<head>\r\n<meta name=\""..., len=20520) at
protocol.c:1453
#29 0x0806ffcc in ap_rwrite (buf=0x875e3bc, nbyte=20520, r=0x8694278)
at protocol.c:1488
#30 0x010c90a5 in php_apache_sapi_ub_write (
    str=0x875e3bc "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\r\n<html
xmlns=\"http://www.w3.org/1999/xhtml\"; xml:lang=\"fr\"
lang=\"fr\">\r\n<head>\r\n<meta name=\""..., str_length=20520)
    at /root/download/php/php-5.2.17/sapi/apache2handler/sapi_apache2.c:78
#31 0x0102ada3 in php_ub_body_write_no_header (
    str=0x875e3bc "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\r\n<html
xmlns=\"http://www.w3.org/1999/xhtml\"; xml:lang=\"fr\"
lang=\"fr\">\r\n<head>\r\n<meta name=\""..., str_length=20520) at
/root/download/php/php-5.2.17/main/output.c:684
#32 0x0102b377 in php_end_ob_buffer (send_buffer=1 '\001',
just_flush=0 '\0') at /root/download/php/php-5.2.17/main/output.c:294
#33 0x0102ba38 in zif_ob_end_flush (ht=0, return_value=0x86a4084,
return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
    at /root/download/php/php-5.2.17/main/output.c:810
#34 0x0109162a in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfe85990) at
/root/download/php/php-5.2.17/Zend/zend_vm_execute.h:200
#35 0x0107e370 in execute (op_array=0x8645d04) at
/root/download/php/php-5.2.17/Zend/zend_vm_execute.h:92
#36 0x0105c282 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /root/download/php/php-5.2.17/Zend/zend.c:1134
#37 0x010199c6 in php_execute_script (primary_file=0xbfe87c38) at
/root/download/php/php-5.2.17/main/main.c:2036
#38 0x010c9a08 in php_handler (r=0x8694278) at
/root/download/php/php-5.2.17/sapi/apache2handler/sapi_apache2.c:639
#39 0x0807cf29 in ap_run_handler (r=0x8694278) at config.c:157
#40 0x08080289 in ap_invoke_handler (r=0x8694278) at config.c:372
#41 0x080ae740 in ap_internal_redirect (new_uri=0x8690e08 "/404.php",
r=0x871e0c8) at http_request.c:501
#42 0x080ae7a9 in ap_process_request (r=0x871e0c8) at http_request.c:296
#43 0x080ab988 in ap_process_http_connection (c=0x867c390) at http_core.c:190
#44 0x08084299 in ap_run_process_connection (c=0x867c390) at connection.c:43
#45 0x080cc135 in child_main (child_num_arg=<value optimized out>) at
prefork.c:650
#46 0x080cc413 in make_child (s=0x82bcc20, slot=21) at prefork.c:746
#47 0x080cd218 in perform_idle_server_maintenance () at prefork.c:881
#48 ap_mpm_run (_pconf=0x82b6550, plog=0x82f8658, s=0x82bcc20) at prefork.c:1085
#49 0x08069c20 in main (argc=Cannot access memory at address 0x0
) at main.c:740

(gdb) frame 35
#35 0x0107e370 in execute (op_array=0x8645d04) at
/root/download/php/php-5.2.17/Zend/zend_vm_execute.h:92
92                 if (EX(opline)->handler(&execute_data TSRMLS_CC) > 0) {
(gdb)

I've been also looking at this previous post:
http://bugs.php.net/bug.php?id=41130

Can anyone confirm that I have the same problem... infinite loop in
the code somewhere ?

If it is... how can I pinpoint the exact line where the error is ?

--- End Message ---
--- Begin Message ---
On Wed, Mar 9, 2011 at 3:18 AM, Richard Quadling <[email protected]>wrote:

> On 7 March 2011 23:37, Nathan Nobbe <[email protected]> wrote:
> > On Fri, Mar 4, 2011 at 7:29 AM, Richard Quadling <[email protected]>
> > wrote:
> >>
> >> On 3 March 2011 18:30, Nathan Nobbe <[email protected]> wrote:
> >> > Hey gang,
> >> >
> >> > (Yes Tedd, I like your style, when it pertains to how you address the
> >> > list
> >> > :))
> >> >
> >> > I have a new curiosity that's arisen as a result of a new contract I'm
> >> > working on, I'd like to bounce around some thoughts off the list and
> see
> >> > what you folks think if interested.
> >> >
> >> > The topic at hand is stored procedures.  Frankly, I've hardly ever
> even
> >> > seen
> >> > these in use, and what I'm trying to figure out are good rules of
> thumb
> >> > as
> >> > to where / when / how they are best used in application development.
> >> >
> >> > Also, bear in mind that personally I tend to favor OO paradigms for
> >> > application development so would prefer feedback that incorporates
> that
> >> > tendency.
> >> >
> >> > Initial thoughts are
> >> >
> >> > Bad:
> >> > . Not well suited for ORM, particularly procedures which return
> multiple
> >> > result sets consisting of columns from multiple tables
> >> > . Greater potential for duplicated logic, I think this comes down to a
> >> > well
> >> > defined set of rules for any given application, read: convention
> >> > required
> >> > for success
> >> > . Scripting languages are vendor specific, and likely most application
> >> > developers have a limited understanding thereof
> >> >
> >> > Good:
> >> > . Better performance
> >> > . <Fill in blank on convincing bullets here>
> >> >
> >> > I've also done some reading on MSSQL vs. MySQL and found that the
> former
> >> > offers much more features.  I've also read that most databases only
> see
> >> > roughly 40% of the feature sets being used for typical applications in
> >> > the
> >> > wild, and would agree from personal experience it is accurate.
> >> >
> >> > From my standpoint MySQL is popular because the features it offers are
> >> > the
> >> > features folks are really looking, one of those 80/20 things...
> >> >
> >> > I stumbled into this link on a google search, it's from '04 but looks
> to
> >> > be
> >> > relevant to this day
> >> >
> >> >
> >> >
> http://www.codinghorror.com/blog/2004/10/who-needs-stored-procedures-anyways.html
> >> >
> >> > Your thoughts appreciated,
> >> >
> >> > -nathan
> >> >
> >>
> >> Hello Nathan.
> >>
> >> I develop for and on Windows using IIS7 and MS SQL Server
> >> 7/2000/2005/2008.
> >
> > i love how you preface many of your responses like this.
> >
> >>
> >> Almost exclusively I use prepared statements to talk to stored
> >> procedures and views. I use triggers and constraints to enforce RDI. I
> >> _do_ have the occasional hacky script which includes SQL, but only
> >> 'cause I was being lazy and wanted to do a one off change.
> >
> > this sounds as if you're doing next to 0 query generation from php, is
> that
> > correct?
> >>
> >> At a fundamental level, my PHP code isn't concerning itself with any
> >> physical data structures. As much as possible my PHP code treats the
> >> sql data source as a processor ready to supply data in a standardized
> >> form (even hierarchical) and to accept data for storage (again
> >> hierarchical). My PHP code knows next to nothing about the table
> >> structure (why should it - it isn't a database). It does know that a
> >> "customer" object has a set of properties and a set of "instruments of
> >> change" which are passed to the SQL server to effect the data and are
> >> cached locally. PHP deals in objects/entities. Stored procedures
> >> provide the translation between the OOP and the RDBMS. This provides a
> >> nice clean interface between PHP and the data. The stored procedures
> >> and views are all pre-compiled - with their internal usage statistics
> >> to make best use of available indices and are tuned to the actual data
> >> rather than something I thought I knew about the data usage when I
> >> designed the DB. So speed is much more significant. Having every
> >> single SQL statement compiled from scratch for a 1 off use would seem
> >> wasteful.
> >>
> >> Multiple result sets are completely fine (at least for MS SQL Server)
> >> - Admittedly you have to currently process the result sets in
> >> sequential order (i.e. set 1 before moving to set 2 - can't move back
> >> to set 1). But that is something quite easy to work with when you know
> >> the limitation. And is the easiest way to get hierarchical data into
> >> PHP for me. I get all the relevant data in 1 hit rather than getting
> >> the data with potential mis-matching values due to the realtime
> >> multi-user environment.
> >
> > i understand the ability to consume multiple result sets is available.
>  the
> > issue i think would be raised with an orm would be getting result sets
> with
> > mixed columns from multiple tables.  im not sure how capable an orm like
> > propel (for example) is of mapping those results back to objects.  at a
> > glance of google results it appears the result is just an array which
> > sacrifices the abstraction the orm aims to provide.
> > -nathan
>
> All my new projects are using stored procedures and views. No direct
> access to the tables. This means that if I use PHP or Excel VBA or
> Delphi or C or any other language, every single request will be
> processed in an identical way. No variation (seen/unseen,
> known/unknown).
>
> Some unknown nuance related to my coding/knowledge, or an unseen side
> effect/bug ... more or less disappear. Making data storage and
> retrieval a function of the data store and not something to be
> "constructed" in PHP (with all the hassles of unicode/escaping/etc.)
> and then re-constructed/coded in Excel VBA, Crystal Reports, etc.
>
> I don't use an ORM as I don't have the same ability to do that in
> Delphi/C/Excel.
>
> Having to work in multiple languages, all talking to the same DB, it
> seemed sensible to create a wall between data consumer and data
> provider.
>
> Is this for everyone? Probably not, but it helps me.


This makes a lot of sense and actually brings up a point I've not yet
considered or heard mentioned.

I can think back of a time I was working on an app which had PHP & Java
accessing the database.

There was a lot of confusion about which language accessed the database, and
for what, and I can say there surely was duplicated queries between the 2
app layers.

Thanks for this insight Richard.

-nathan

--- End Message ---
--- Begin Message ---
Hi,
I'm newbie to PHP and this list, possible not a new question so forgive me if 
it's a repeat 
I have a form where I want the submitter Email ID to only be from one domain

Here's the part I'm having issues with 

                                        $domain = explode( "@", $who);
                        if ( $domain[1] == "company.com") {
                                        echo $domain[1];
                                        echo("<h3>Email invalid.</h3>");
                                        exit;
                                        }

First Echo is just for me to check 
I type in a correct Email ID, say [email protected] 

The return of this is:

company.com
Email invalid.


As far as I can see this if statement should not fall in, what am I missing?



--- End Message ---

Reply via email to