php-general Digest 29 Sep 2013 16:30:23 -0000 Issue 8382

Topics (messages 322207 through 322218):

Re: Switch Statement
        322207 by: Aziz Saleh
        322209 by: Jim Giner
        322210 by: Jim Giner
        322212 by: Ethan Rosenberg
        322213 by: Ethan Rosenberg
        322214 by: Jim Giner
        322215 by: Jim Giner
        322217 by: Aziz Saleh

Re: create a local temp table in local machine
        322208 by: Bastien
        322211 by: iccsi

Running a command without shell
        322216 by: vitalif.yourcmc.ru

delete S3 bucket with AWS PHP SDK
        322218 by: Tim Dunphy

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Ethan, can you do a var_dump instead of print_r. It might be that next_step
has spaces in it causing the switch to not match.

Aziz


On Sat, Sep 28, 2013 at 10:33 PM, Ethan Rosenberg <
erosenb...@hygeiabiomedical.com> wrote:

> Dear List -
>
> I have a working program.  I made one change in a switch statement, and it
> does not work.  I'm probably missing something fundamental.
>
> Here are some code SNIPPETS...  [please note that all my debug statements
> are at the left margin]
>
> Setup...
>
> <?php
>         session_start();
>         session_name("STORE");
>         set_time_limit(2400);
>         ini_set('display_errors', 'on');
>         ini_set('display_startup_**errors', 'on');
>         error_reporting(-2);
>
>         ini_set('error_reporting', 'E_ALL | E_STRICT');
>         ini_set('html_errors', 'On');
>         ini_set('log_errors', 'On');
>         require '/home/ethan/P/wk.inc'; //password file
>         $db = "Store";
>         $cxn =mysqli_connect($host,$user,$**password,$db);
>         if (!$cxn)
>         {
>         die('Connect Error (' . mysqli_connect_errno() . ') '
>         . mysqli_connect_error());
>         }// no error
>         if($_REQUEST['welcome_already_**seen']!= "already_seen")
>
>                 show_welcome();
>
>         //end setup
>         function show_welcome() //this is the input screen
>         {
>                 <snip>
>
>         echo " <input type='hidden' name='welcome_already_seen'
> value='already_seen'>";
>         echo " <input type='hidden' name='next_step' value='step20' />";
>
>                 <snip>
>         }
>
>
>                 //end input screen
>
>         //Switch statement
>
> echo 'before';
> print_r($_POST); //post#1
>
>         switch ( $_POST['next_step'] )
>         {
>
>                 case 'step20':
>                 {
> pint_r($_POST); //post#2
> echo 'step20';
>                         if(!empty($_POST['Cust_Num']))
>                                 good();
>                         if(empty($_POST['Cust_Num']))
>                                 bad();
>                         break;
>                 } //end step20
>
>                 <snip>
>         } //end switch
>
>
>
> post#1
>
> beforeArray
> (
>     [Cust_Num] => 123
>     [Fname] =>
>     [Lname] =>
>     [Street] =>
>     [City] =>
>     [state] => NY
>     [Zip] => 10952
>     [PH1] =>
>     [PH2] =>
>     [PH3] =>
>     [Date] =>
>     [welcome_already_seen] => already_seen
>     [next_step] => step20
>
> )
>
> Cust_Num state and Zip are as entered.
>
> The switch statement is never entered, since post#2 is never displayed,
> and neither good() or bad() functions are entered.
>
>
> TIA
>
> Ethan
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On 9/28/2013 10:33 PM, Ethan Rosenberg wrote:
Dear List -

I have a working program.  I made one change in a switch statement, and
it does not work.  I'm probably missing something fundamental.

Here are some code SNIPPETS...  [please note that all my debug
statements are at the left margin]

Setup...

<?php
     session_start();
     session_name("STORE");
     set_time_limit(2400);
     ini_set('display_errors', 'on');
     ini_set('display_startup_errors', 'on');
     error_reporting(-2);

     ini_set('error_reporting', 'E_ALL | E_STRICT');
     ini_set('html_errors', 'On');
     ini_set('log_errors', 'On');
     require '/home/ethan/P/wk.inc'; //password file
     $db = "Store";
     $cxn =mysqli_connect($host,$user,$password,$db);
     if (!$cxn)
     {
     die('Connect Error (' . mysqli_connect_errno() . ') '
         . mysqli_connect_error());
     }// no error
     if($_REQUEST['welcome_already_seen']!= "already_seen")
         show_welcome();

     //end setup
     function show_welcome() //this is the input screen
     {
         <snip>

     echo " <input type='hidden' name='welcome_already_seen'
value='already_seen'>";
     echo " <input type='hidden' name='next_step' value='step20' />";

         <snip>
     }


         //end input screen

     //Switch statement

echo 'before';
print_r($_POST); //post#1

     switch ( $_POST['next_step'] )
     {

         case 'step20':
         {
pint_r($_POST);    //post#2
echo 'step20';
             if(!empty($_POST['Cust_Num']))
                 good();
             if(empty($_POST['Cust_Num']))
                 bad();
             break;
         } //end step20

         <snip>
     } //end switch



post#1

beforeArray
(
     [Cust_Num] => 123
     [Fname] =>
     [Lname] =>
     [Street] =>
     [City] =>
     [state] => NY
     [Zip] => 10952
     [PH1] =>
     [PH2] =>
     [PH3] =>
     [Date] =>
     [welcome_already_seen] => already_seen
     [next_step] => step20

)

Cust_Num state and Zip are as entered.

The switch statement is never entered, since post#2 is never displayed,
and neither good() or bad() functions are entered.


TIA

Ethan


Once again you are posting code that has no chance of running. And since you are DISABLING error reporting with that "-2" value you won't even know you have bad code.

Try again.  Post#2 will never display since you aren't printing it.

--- End Message ---
--- Begin Message ---
<?php
     session_start();
     session_name("STORE");
     set_time_limit(2400);
     ini_set('display_errors', 'on');
     ini_set('display_startup_errors', 'on');
     error_reporting(-2);

     ini_set('error_reporting', 'E_ALL | E_STRICT');
     ini_set('html_errors', 'On');
     ini_set('log_errors', 'On');

Ethan,Ethan,Ethan - what is all this "stuff" you have at the top??? Do you know how any of this is supposed to be written? You can not put Constants in quotes - they become just plain strings then, not Constants with the predefined values you (and the functions) are expecting. For example, 'on' is NOT the same as the use of the word : on. And your error_reporting setting (which you are attempting to do TWICE) is actually causing your script to NOT show any errors, which is preventing you from seeing that your script dies at the misspelled print statement and never gets to the pair of if statements that should call your good and bad functions.

Hate to do this to you, but you've been attempting to pick up PHP for two years now almost and from this latest post you appear to not have learned anything.

And WHY would you EVER want to have a time limit of 2400 seconds???????

And stop burying functions in the middle of your straight line code. It's ridiculous and makes reading your scripts a royal PIA.



--- End Message ---
--- Begin Message ---
On 09/28/2013 11:59 PM, Jim Giner wrote:
<?php
     session_start();
     session_name("STORE");
     set_time_limit(2400);
     ini_set('display_errors', 'on');
     ini_set('display_startup_errors', 'on');
     error_reporting(-2);

     ini_set('error_reporting', 'E_ALL | E_STRICT');
     ini_set('html_errors', 'On');
     ini_set('log_errors', 'On');

Ethan,Ethan,Ethan - what is all this "stuff" you have at the top???  Do
you know how any of this is supposed to be written?  You can not put
Constants in quotes - they become just plain strings then, not Constants
with the predefined values you (and the functions) are expecting.  For
example, 'on' is NOT the same as the use of the word :  on.  And your
error_reporting setting (which you are attempting to do TWICE) is
actually causing your script to NOT show any errors, which is preventing
you from seeing that your script dies at the misspelled print statement
and never gets to the pair of if statements that should call your good
and bad functions.

Hate to do this to you, but you've been attempting to pick up PHP for
two years now almost and from this latest post you appear to not have
learned anything.

And WHY would you EVER want to have a time limit of 2400 seconds???????

And stop burying functions in the middle of your straight line code.
It's ridiculous and makes reading your scripts a royal PIA.

Jim -

Thanks.

Changed error_reporting to -1. No error messages. No change in output.

Ethan

--- End Message ---
--- Begin Message ---
On 09/28/2013 10:53 PM, Aziz Saleh wrote:
Ethan, can you do a var_dump instead of print_r. It might be that next_step
has spaces in it causing the switch to not match.

Aziz


<snip>

Aziz -

Used var_dump no further information

Ethan


--- End Message ---
--- Begin Message ---
On 9/29/2013 1:29 AM, Ethan Rosenberg wrote:
On 09/28/2013 11:59 PM, Jim Giner wrote:
<?php
     session_start();
     session_name("STORE");
     set_time_limit(2400);
     ini_set('display_errors', 'on');
     ini_set('display_startup_errors', 'on');
     error_reporting(-2);

     ini_set('error_reporting', 'E_ALL | E_STRICT');
     ini_set('html_errors', 'On');
     ini_set('log_errors', 'On');

Ethan,Ethan,Ethan - what is all this "stuff" you have at the top???  Do
you know how any of this is supposed to be written?  You can not put
Constants in quotes - they become just plain strings then, not Constants
with the predefined values you (and the functions) are expecting.  For
example, 'on' is NOT the same as the use of the word :  on.  And your
error_reporting setting (which you are attempting to do TWICE) is
actually causing your script to NOT show any errors, which is preventing
you from seeing that your script dies at the misspelled print statement
and never gets to the pair of if statements that should call your good
and bad functions.

Hate to do this to you, but you've been attempting to pick up PHP for
two years now almost and from this latest post you appear to not have
learned anything.

And WHY would you EVER want to have a time limit of 2400 seconds???????

And stop burying functions in the middle of your straight line code.
It's ridiculous and makes reading your scripts a royal PIA.

Jim -

Thanks.

Changed error_reporting to -1. No error messages. No change in output.

Ethan
CORRECT ALL THE WRONG SHIT AND YOU"LL GET ERROR MESSAGES!!!

--- End Message ---
--- Begin Message ---
On 9/29/2013 1:38 AM, Jim Giner wrote:
   session_start();
     session_name("STORE");
     set_time_limit(2400);
     ini_set('display_errors', 'on');
     ini_set('display_startup_errors', 'on');
     error_reporting(-2);

     ini_set('error_reporting', 'E_ALL | E_STRICT');
     ini_set('html_errors', 'On');
     ini_set('log_errors', 'On');
This is what you should have in place of all of the above:

session_start();
error_reporting(E_ALL | E_STRICT | E_NOTICE); ini_set('display_errors', '1');
set_time_limit(2);// if you use more than 2 secs you have a problem




--- End Message ---
--- Begin Message ---
What is the output?


On Sun, Sep 29, 2013 at 1:34 AM, Ethan Rosenberg <
erosenb...@hygeiabiomedical.com> wrote:

> On 09/28/2013 10:53 PM, Aziz Saleh wrote:
>
>> Ethan, can you do a var_dump instead of print_r. It might be that
>> next_step
>> has spaces in it causing the switch to not match.
>>
>> Aziz
>>
>>
>>  <snip>
>
> Aziz -
>
> Used var_dump no further information
>
>
> Ethan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---

Thanks,

Bastien

> On Sep 28, 2013, at 8:24 PM, "iccsi" <inu...@gmail.com> wrote:
> 
> Thanks for the information and help,
> Yes, my data is pretty much static,
> Can you please give me some link for the solution?
> It is the solution I am looking for my current situation,
> 
> Thanks a million for helping,
> 
> Regards,
> 
> Iccsi,

I don't have a link unfortunately. The system I did it for is proprietary. But 
I do recall it was a pretty switch in the JS to view the list from the static 
file. The JS file with the static data was just an array and the autocomplete 
looked at that as the data source

Sorry

Bastien

--- End Message ---
--- Begin Message ---
Thanks for the message,
Do you have any information how to create JS file and how to access from jQuery auto complete?
Thanks again for helping,

Regards,

Iccsi,



"Bastien" wrote in message news:57469e24-56e6-40c9-8176-64cd8444f...@gmail.com...



Thanks,

Bastien

On Sep 28, 2013, at 8:24 PM, "iccsi" <inu...@gmail.com> wrote:

Thanks for the information and help,
Yes, my data is pretty much static,
Can you please give me some link for the solution?
It is the solution I am looking for my current situation,

Thanks a million for helping,

Regards,

Iccsi,

I don't have a link unfortunately. The system I did it for is proprietary. But I do recall it was a pretty switch in the JS to view the list from the static file. The JS file with the static data was just an array and the autocomplete looked at that as the data source

Sorry

Bastien
--- End Message ---
--- Begin Message ---
Hi!

Is it possible to run a command and capture its output via an FD (like in proc_open()), but without using the shell? As far as I can see now there is no way to do it. I think that's a simple feature, maybe just add it to proc_open()? (for example run command directly using exec() if the first argument is an array?) it would be rational because there is already such option for Windows...

--
With best regards,
  Vitaliy Filippov

--- End Message ---
--- Begin Message ---
Hi All,

 I am attempting to delete an empty S3 bucket using the AWS PHP SDK.

 Here's how they describe the process in the docs:

$result = $client->deleteBucket(array(
    // Bucket is required
    'Bucket' => 'string',
));

 You can find the full entry here:

AWS PHP SDK Delete Bucket
Docs<http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.S3.S3Client.html#_deleteBucket>

Here's how I approached it in my code:

 $s3 = new AmazonS3();

  $result = $s3->deleteObject(array(
    'Bucket' => $bucket_name ));

But when I run it, this is the error I get:

'Notice: Undefined index: $bucket_name in /var/www/awssdk/delete_bucket.php
on line 5 Warning: Missing argument 2 for AmazonS3::delete_object() in
/var/www/awssdk/services/s3.class.php on line 1576 Notice: Undefined
variable: filename in /var/www/awssdk/services/s3.class.php on line 1581
Warning: preg_match() expects parameter 2 to be string, array given in
/var/www/awssdk/services/s3.class.php on line 1042 Warning: preg_match()
expects parameter 2 to be string, array given in
/var/www/awssdk/services/s3.class.php on line 1043 Fatal error: Uncaught
exception 'S3_Exception' with message 'S3 does not support "Array" as a
valid bucket name. Review "Bucket Restrictions and Limitations" in the S3
Developer Guide for more information.' in
/var/www/awssdk/services/s3.class.php:548 Stack trace: #0
/var/www/awssdk/services/s3.class.php(1594): AmazonS3->authenticate(Array,
Array) #1 [internal function]: AmazonS3->delete_object(Array) #2
/var/www/awssdk/sdk.class.php(436): call_user_func_array(Array, Array) #3
/var/www/awssdk/delete_bucket.php(10): CFRuntime->__call('deleteObject',
Array) #4 /var/www/awssdk/delete_bucket.php(10):
AmazonS3->deleteObject(Array) #5 {main} thrown in
/var/www/awssdk/services/s3.class.php on line 548'


This is line 548 in the above referenced file:

// Validate the S3 bucket name
                if (!$this->validate_bucketname_support($bucket))
                {
                        // @codeCoverageIgnoreStart
                        throw new S3_Exception('S3 does not support "' .
$bucket . '" as a valid bucket name. Review "Bucket Restrictions and
Limitations" in the S3 Developer Guide for more information.');
                        // @codeCoverageIgnoreEnd
                }




Has anyone played around enough with the AWS SDK to know what I'm doing
wrong here? Would anyone else be able to hazard a guess?

Thanks
Tim
-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B

--- End Message ---

Reply via email to