php-general Digest 16 Dec 2007 20:05:24 -0000 Issue 5184

Topics (messages 265945 through 265951):

Re: php code compiles, produces good html output, but crashes when put through 
browser
        265945 by: Jochem Maas
        265947 by: Casey
        265948 by: Jochem Maas
        265949 by: Per Jessen

Re: temp tables mysql OT
        265946 by: Jochem Maas
        265950 by: tedd

PRG pattern - how to implement a "load page using GET"
        265951 by: Robert Erbaron

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 ---
Casey wrote:
> Comment out all Javascript.

Casey - exactly how would javascript being causing a webserver to segfault
in this context???

> 
> On Dec 15, 2007, at 2:00 PM, "Daniel Brown" <[EMAIL PROTECTED]> wrote:
> 
>> On Dec 15, 2007 4:55 PM, Mary Anderson <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> My code
>>>
>>> http://demog.berkeley.edu/~maryfran/memdev/get_data_set.php
>>>
>>
>>    Mary,
>>
>>    Can you provide the actual code for the page?  None of us can
>> really help you out too much without seeing more than a blank page.
>>
>>
>> -- 
>> Daniel P. Brown
>> [Phone Numbers Go Here!]
>> [They're Hidden From View!]
>>
>> If at first you don't succeed, stick to what you know best so that you
>> can make enough money to pay someone else to do it for you.
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
> 

--- End Message ---
--- Begin Message ---
On Dec 15, 2007 11:27 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Casey wrote:
> > Comment out all Javascript.
>
> Casey - exactly how would javascript being causing a webserver to segfault
> in this context???
>
>
> >
> > On Dec 15, 2007, at 2:00 PM, "Daniel Brown" <[EMAIL PROTECTED]> wrote:
> >
> >> On Dec 15, 2007 4:55 PM, Mary Anderson <[EMAIL PROTECTED]>
> >> wrote:
> >>>
> >>> My code
> >>>
> >>> http://demog.berkeley.edu/~maryfran/memdev/get_data_set.php
> >>>
> >>
> >>    Mary,
> >>
> >>    Can you provide the actual code for the page?  None of us can
> >> really help you out too much without seeing more than a blank page.
> >>
> >>
> >> --
> >> Daniel P. Brown
> >> [Phone Numbers Go Here!]
> >> [They're Hidden From View!]
> >>
> >> If at first you don't succeed, stick to what you know best so that you
> >> can make enough money to pay someone else to do it for you.
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
>
>

Maybe I didn't read well enough, but if the PHP produces proper HTML
on the command line, shouldn't it work in the browser too? My logic is
that if the title displays, then the browser hangs, it should be
something on the client-side, right?

Maybe I'm not thinking clearly. I worked all day today..
-Casey

--- End Message ---
--- Begin Message ---
Casey wrote:
> On Dec 15, 2007 11:27 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
>> Casey wrote:
>>> Comment out all Javascript.
>> Casey - exactly how would javascript being causing a webserver to segfault
>> in this context???
>>
>>
>>> On Dec 15, 2007, at 2:00 PM, "Daniel Brown" <[EMAIL PROTECTED]> wrote:
>>>
>>>> On Dec 15, 2007 4:55 PM, Mary Anderson <[EMAIL PROTECTED]>
>>>> wrote:
>>>>> My code
>>>>>
>>>>> http://demog.berkeley.edu/~maryfran/memdev/get_data_set.php
>>>>>
>>>>    Mary,
>>>>
>>>>    Can you provide the actual code for the page?  None of us can
>>>> really help you out too much without seeing more than a blank page.
>>>>
>>>>
>>>> --
>>>> Daniel P. Brown
>>>> [Phone Numbers Go Here!]
>>>> [They're Hidden From View!]
>>>>
>>>> If at first you don't succeed, stick to what you know best so that you
>>>> can make enough money to pay someone else to do it for you.
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>
> 
> Maybe I didn't read well enough, but if the PHP produces proper HTML
> on the command line, shouldn't it work in the browser too? My logic is
> that if the title displays, then the browser hangs, it should be
> something on the client-side, right?

if the client-side (browser) recieves no data then it can't display anything,
besides I'm sure Mary is savvy enough to know that a javascript problem is
something not for this list ... besides which she said that the output of
her script when from the command line can be saved and viewed in a browser 
without
problem.

> 
> Maybe I'm not thinking clearly. I worked all day today..
> -Casey
> 

--- End Message ---
--- Begin Message ---
Casey wrote:

> Maybe I didn't read well enough, but if the PHP produces proper HTML
> on the command line, shouldn't it work in the browser too? 

Not necessarily.  Running stand-alone and in the webserver are two
completely different environments. 

> My logic is that if the title displays, then the browser hangs, it
> should be something on the client-side, right?

It _could_ be, but I doubt it.  The browser/client might be "hanging"
waiting for the server to finish. 


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
tedd wrote:
> At 12:20 PM +0100 12/13/07, Zoltán Németh wrote:
>> 2007. 12. 12, szerda keltezéssel 20.13-kor tedd ezt írta:
>>  > I would like to create a temporary table to perform searches.
>>>
>>>   From my main table, I need to exclude records that have certain
>>>  fields that are null or empty; and then sort the final result.
>>
>> why do you need a temp table for that?
>> select * from blah where not isnull(checkfield) and checkfield <> ''
>> order by someotherfield
> 
> Zoltán:
> 
> Ok, here's the problem.
> 
> I have a table with over 5000 records.
> 
> There is no index (not my dB) and the records are not complete.
> 
> There is a numeric product_id field, but in the dB this is not in sequence.
> 
> Some records have a product_id, but no product_name.
> 
> I need to travel the dB showing each item in order (product _id) and
> excluding those products that have no product_name.
> 
> That sounds simple enough, but currently for each step the entire table
> gets sorted (unless I'm doing it wrong).
> 
> I was thinking that I could:
> 
> 1. Create a temporary table.
> 2. Sort the table once.
> 3. Remove the records that have no product_name
> 4. And then just travel the temporary table for the duration of the script.
> 5. Drop the table when done with it.
> 
> Now, what's wrong with my thinking?

you mean in general? :-P
on a serious note I'd go with Richard's analysis - the number of records
is next to nothing, indexed or not.

so the only thing wrong with your plan of attack is that's it's
overkill it seems other than than it's a sound strategy, we're programmers
right? we're lazy ... we encourage you to do less :-).

I guess back in day when rocks[tm] were still in vogue you would have had
to be much more frugal with the meager cycles at your disposal - we're
spoiled for cycles these days :-)


> 
> Cheers,
> 
> tedd
> 
> 
> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
At 8:34 AM +0100 12/16/07, Jochem Maas wrote:
I guess back in day when rocks[tm] were still in vogue you would have had
to be much more frugal with the meager cycles at your disposal - we're
spoiled for cycles these days :-)

I gave up mine when cars came along.

To all -- All points well taken guys.

I look at tables more like an array now.

Thanks for all the input.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
I've been reading up on login mechanisms using redirects, and have a
basic mechanism down.

a1.php:
<?php
$site_title='My Site';
if (isset($_SESSION['errmsg_s']))
  {$errmsg = 'Warning! '.$_SESSION['errmsg_s'].'!';}
else
  {$errmsg = ''; }
if (isset($_SESSION['email_s']))
  { unset($_SESSION['email_s']);}
echo '<h1>Welcome to '.$site_title.'</h1><br>';
echo $errmsg;
?>
<!-- form goes here and calls a2.php -->

a2.php:
<?php
$email = $_POST['email'];
if // (test email for goodness against database) {
 $_SESSION['email_s'] = $email;
 unset($_SESSION['errmsg_s']);
 // stuff successful login into database
 session_write_close();
 header('Location: a3.php');
 exit;}
else {
 $_SESSION['errmsg_s']="Re-enter your email";
 unset($_SESSION['email_s']);
 session_write_close();
 header('Location: a1.php');
 exit;}
?>

a3.php:
<?php
if (empty($_SESSION['email_s'])) {
session_write_close();
header('Location: a1.php');
exit;}
$email = $_SESSION['email_s'];
echo 'Hello there,'.$email.'. We are glad to have you here.<br>';
?>

OK, looks like this handles refresh (resubmit) and back button issues.
Hitting back when on page 3 empties 'email', so resubmitting does a
brand new login. (If I'm missing something, holler.)

However, the seminal article at
http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost
says:
- Never show pages in response to POST
- Navigate from POST to GET using REDIRECT
- Always load pages using GET

I get the first and the second, and understand how to implement them.
The third, though. Sorry, I'm missing something. I simply don't
understand what they mean or how to do it. Can someone translate my
little a3.php page into 'using GET' instead of just grabbing the
session var again? And why is that necessary?

(P.S. I'll get to the issue of rearchitecting this via require instead
of using header() redirects,cough, cough, Richard Lynch, cough, cough
:) in a future message. One step at a time...)
-- 
RE, Chicago

--- End Message ---

Reply via email to