RE: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Cor
Hi Karl,

The Flash part is no problem.
But in PHP I am a novice!

So far I learned that I should think of sending Strings to PHP instead of a
complete multi-dim array.
I don't know how to set up PHP to open it once. Do all your sending and
inserting, then close once I am done?
Do you have some examples of your construction with the different
files/classes?

Best regards,
Cor van Dooren

-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl
DeSaulniers
Sent: dinsdag 6 september 2011 6:24
To: Flash Coders List
Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL
with PHP

Correction...

_parent.status = this.status;
}
};
mylv.sendAndLoad("http://yourwebsite.com/process.php";, myreply,
"POST");
_parent.status = "sending now ...";
//end while loop here
}

Best,
Karl

On Sep 5, 2011, at 11:20 PM, Karl DeSaulniers wrote:

> Hey Cor,
> This is how I have it set up in as2, you may be able to port easier 
> than I.
>
> send_btn.onRelease = function() {
>   //Creates a LoadVars and get values from the form
>   mylv = new LoadVars();
>   myreply = new LoadVars();
>   mylv.formTrue = "1"; //Verify were on our form
>   //could put a while loop here mylv.id = myArray[i]['id'];
>   mylv.id = id.text;
>   mylv.name = name_txt.text;
>   mylv.description = description.text;
>   //Show success or fails message
>   myreply.onLoad = function() {
>   if(this.status === "Mail sent!") { //Success!
>   newStatus = this.status + " - Thank you for
your response. We will 
> get in touch with you at "+email_txt.text+".- Company";
>   gotoAndPlay("send_off");
>   } else if(this.status === "Mail Failed!"){//Mail
Failed with error
>   _parent.status = this.status + "Sorry
there was a problem 
> sending your message. Please try again or try again at a later time.
> We apologize for any inconvenience.";
>   } else {
>   _parent.status = this.status;
>   }
>   //end while loop here
>   };
>   mylv.sendAndLoad("http://yourwebsite.com/process.php";, myreply, 
> "POST");
>   _parent.status = "sending now ...";
> }
>
> Obviously this is for a mail form and needs to be seasoned to taste, 
> but..
> HTH,
>
> Best,
> Karl
>
> On Sep 5, 2011, at 11:07 PM, Karl DeSaulniers wrote:
>
>> I think you may be able to use the php split() or explode() on a 
>> array of data sent.
>> but probably easier to split it up when gathering the info in flash.
>> multiple small queries instead of a bulky single query?
>>
>> Karl
>>
>>
>> On Sep 5, 2011, at 10:34 PM, Cor wrote:
>>
>>> Do you mean that is it not possible to send an array from Flash to 
>>> PHP in this way:
>>>
>>> private function validateAndSend(e:MouseEvent):void {
>>> form_variables = new URLVariables();
>>> form_varSend=new URLRequest(Main.PHP_URL+"control.php");
>>> form_varSend.method=URLRequestMethod.POST;
>>> form_varSend.data=form_variables;
>>> form_varLoader=new URLLoader  ;
>>> form_varLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
>>> form_variables.sendRequest = "registreer_materiaal";
>>> form_variables.VALUES = myMultiDimArray;
>>> form_varLoader.addEventListener(Event.COMPLETE,
>>> completeLoadHandler);   
>>> form_varLoader.load(form_varSend);
>>> }
>>>
>>>
>>> -Original Message-
>>> From: flashcoders-boun...@chattyfig.figleaf.com
>>> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Dave 
>>> Watts
>>> Sent: dinsdag 6 september 2011 5:27
>>> To: Flash Coders List
>>> Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash 
>>> to mySQL with PHP
>>>
 My problem is how to fetch my $_POST['VALUES'], which is the 
 multi-dimensional  array:

 myArray[0["id"]
 myArray[0]["name"]
 myArray[0]["description"]

 ...

 etc.
>>>
>>> I'm not a PHP expert, but in general you can't really submit an 
>>> array as form data directly to a CGI program. You have to post 
>>> name-value pairs - if you have a set of array values, they'd simply 
>>> end up having the same name and different values (like a checkbox 
>>> array in HTML, for example).
>>> In your
>>> case, things are a bit more complicated because you have an array of 
>>> structs, basically, so you'll need to convert those to a bunch of 
>>> individual name-value pairs in order to submit them to a CGI 
>>> program.
>>>
>>> Dave Watts, CTO, Fig Leaf Software
>>> http://www.figleaf.com/
>>> http://training.figleaf.com/
>>>
>>> Fig Leaf Software is a Veteran-Owned Small Busines

Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Karl DeSaulniers

Correction...

_parent.status = this.status;
}
};
	mylv.sendAndLoad("http://yourwebsite.com/process.php";, myreply,  
"POST");

_parent.status = "sending now ...";
//end while loop here
}

Best,
Karl

On Sep 5, 2011, at 11:20 PM, Karl DeSaulniers wrote:


Hey Cor,
This is how I have it set up in as2, you may be able to port easier  
than I.


send_btn.onRelease = function() {
//Creates a LoadVars and get values from the form
mylv = new LoadVars();
myreply = new LoadVars();
mylv.formTrue = "1"; //Verify were on our form
//could put a while loop here mylv.id = myArray[i]['id'];
mylv.id = id.text;
mylv.name = name_txt.text;
mylv.description = description.text;
//Show success or fails message
myreply.onLoad = function() {
if(this.status === "Mail sent!") { //Success!
newStatus = this.status + " - Thank you for your response. We  
will get in touch with you at "+email_txt.text+".- Company";

gotoAndPlay("send_off");
} else if(this.status === "Mail Failed!"){//Mail Failed 
with error
_parent.status = this.status + "Sorry there was a problem  
sending your message. Please try again or try again at a later time.  
We apologize for any inconvenience.";

} else {
_parent.status = this.status;
}
//end while loop here
};
	mylv.sendAndLoad("http://yourwebsite.com/process.php";, myreply,  
"POST");

_parent.status = "sending now ...";
}

Obviously this is for a mail form and needs to be seasoned to taste,  
but..

HTH,

Best,
Karl

On Sep 5, 2011, at 11:07 PM, Karl DeSaulniers wrote:

I think you may be able to use the php split() or explode() on a  
array of data sent.

but probably easier to split it up when gathering the info in flash.
multiple small queries instead of a bulky single query?

Karl


On Sep 5, 2011, at 10:34 PM, Cor wrote:

Do you mean that is it not possible to send an array from Flash to  
PHP in

this way:

private function validateAndSend(e:MouseEvent):void {
form_variables = new URLVariables();
form_varSend=new URLRequest(Main.PHP_URL+"control.php");
form_varSend.method=URLRequestMethod.POST;
form_varSend.data=form_variables;
form_varLoader=new URLLoader  ;
form_varLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
form_variables.sendRequest = "registreer_materiaal";
form_variables.VALUES = myMultiDimArray;
form_varLoader.addEventListener(Event.COMPLETE,
completeLoadHandler);   
form_varLoader.load(form_varSend);
}


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of  
Dave Watts

Sent: dinsdag 6 september 2011 5:27
To: Flash Coders List
Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash  
to mySQL

with PHP


My problem is how to fetch my $_POST['VALUES'], which is the
multi-dimensional  array:

myArray[0["id"]
myArray[0]["name"]
myArray[0]["description"]

...

etc.


I'm not a PHP expert, but in general you can't really submit an  
array as
form data directly to a CGI program. You have to post name-value  
pairs - if
you have a set of array values, they'd simply end up having the  
same name
and different values (like a checkbox array in HTML, for example).  
In your

case, things are a bit more complicated because you have an array of
structs, basically, so you'll need to convert those to a bunch of  
individual

name-value pairs in order to submit them to a CGI program.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA  
Schedule,
and provides the highest caliber vendor-authorized instruction at  
our

training centers, online, or onsite.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrum

Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Karl DeSaulniers

Hi Cor,

On Sep 5, 2011, at 11:14 PM, Cor wrote:


Karl,

Thank you very much!!

But this would create a lot of network traffic, open connection and
database, do mysql_query and close db conn??


You only need to open it once. Do all your sending and inserting, then  
close once your done.




You wrote in the previous mail:
I should mention that I use this stuff inside php classes. so $this- 
> has

already been defined as the class your currently in.
Like the database class, $database->addDescription(); is called  
outside the

class. if it was called inside the database class file, it would be
$this->addDescription();. Also, the php file name thats called from  
flash is

database.php. etc, etc. FYI.

- a process.php, this retrieves your variables from flash, makes  
sure its

not a bot, any verify codes checked here, etc
- then send it to your sessions.php for validation and set your  
errors here

to send back with.
- then send to your database.php for stripping, manipulation and  
insertion.


This is what I am looking for (to learn) and where my knowledge of PHP
stops...


This is the best way in my opinion. I learned off of finding a php  
login example.




You can address me directly if you like: codo AT chello DOT nl


I am available if you need. My email is above.



Best regards,
Cor van Dooren


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl
DeSaulniers
Sent: dinsdag 6 september 2011 6:07
To: Flash Coders List
Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash  
to mySQL

with PHP

I think you may be able to use the php split() or explode() on a  
array of

data sent.
but probably easier to split it up when gathering the info in flash.
multiple small queries instead of a bulky single query?

Karl


On Sep 5, 2011, at 10:34 PM, Cor wrote:

Do you mean that is it not possible to send an array from Flash to  
PHP

in this way:

private function validateAndSend(e:MouseEvent):void {
form_variables = new URLVariables();
form_varSend=new URLRequest(Main.PHP_URL+"control.php");
form_varSend.method=URLRequestMethod.POST;
form_varSend.data=form_variables;
form_varLoader=new URLLoader  ;
form_varLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
form_variables.sendRequest = "registreer_materiaal";
form_variables.VALUES = myMultiDimArray;
form_varLoader.addEventListener(Event.COMPLETE,
completeLoadHandler);   
form_varLoader.load(form_varSend);
}


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Dave
Watts
Sent: dinsdag 6 september 2011 5:27
To: Flash Coders List
Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to
mySQL with PHP


My problem is how to fetch my $_POST['VALUES'], which is the
multi-dimensional  array:

myArray[0["id"]
myArray[0]["name"]
myArray[0]["description"]

...

etc.


I'm not a PHP expert, but in general you can't really submit an array
as form data directly to a CGI program. You have to post name-value
pairs - if you have a set of array values, they'd simply end up  
having
the same name and different values (like a checkbox array in HTML,  
for

example).
In your
case, things are a bit more complicated because you have an array of
structs, basically, so you'll need to convert those to a bunch of
individual name-value pairs in order to submit them to a CGI program.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA
Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Karl DeSaulniers

Hey Cor,
This is how I have it set up in as2, you may be able to port easier  
than I.


send_btn.onRelease = function() {
//Creates a LoadVars and get values from the form
mylv = new LoadVars();
myreply = new LoadVars();
mylv.formTrue = "1"; //Verify were on our form
//could put a while loop here mylv.id = myArray[i]['id'];
mylv.id = id.text;
mylv.name = name_txt.text;
mylv.description = description.text;
//Show success or fails message
myreply.onLoad = function() {
if(this.status === "Mail sent!") { //Success!
newStatus = this.status + " - Thank you for your response. We will  
get in touch with you at "+email_txt.text+".- Company";

gotoAndPlay("send_off");
} else if(this.status === "Mail Failed!"){//Mail Failed 
with error
_parent.status = this.status + "Sorry there was a problem  
sending your message. Please try again or try again at a later time.  
We apologize for any inconvenience.";

} else {
_parent.status = this.status;
}
//end while loop here
};
	mylv.sendAndLoad("http://yourwebsite.com/process.php";, myreply,  
"POST");

_parent.status = "sending now ...";
}

Obviously this is for a mail form and needs to be seasoned to taste,  
but..

HTH,

Best,
Karl

On Sep 5, 2011, at 11:07 PM, Karl DeSaulniers wrote:

I think you may be able to use the php split() or explode() on a  
array of data sent.

but probably easier to split it up when gathering the info in flash.
multiple small queries instead of a bulky single query?

Karl


On Sep 5, 2011, at 10:34 PM, Cor wrote:

Do you mean that is it not possible to send an array from Flash to  
PHP in

this way:

private function validateAndSend(e:MouseEvent):void {
form_variables = new URLVariables();
form_varSend=new URLRequest(Main.PHP_URL+"control.php");
form_varSend.method=URLRequestMethod.POST;
form_varSend.data=form_variables;
form_varLoader=new URLLoader  ;
form_varLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
form_variables.sendRequest = "registreer_materiaal";
form_variables.VALUES = myMultiDimArray;
form_varLoader.addEventListener(Event.COMPLETE,
completeLoadHandler);   
form_varLoader.load(form_varSend);
}


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of  
Dave Watts

Sent: dinsdag 6 september 2011 5:27
To: Flash Coders List
Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash  
to mySQL

with PHP


My problem is how to fetch my $_POST['VALUES'], which is the
multi-dimensional  array:

myArray[0["id"]
myArray[0]["name"]
myArray[0]["description"]

...

etc.


I'm not a PHP expert, but in general you can't really submit an  
array as
form data directly to a CGI program. You have to post name-value  
pairs - if
you have a set of array values, they'd simply end up having the  
same name
and different values (like a checkbox array in HTML, for example).  
In your

case, things are a bit more complicated because you have an array of
structs, basically, so you'll need to convert those to a bunch of  
individual

name-value pairs in order to submit them to a CGI program.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA  
Schedule,

and provides the highest caliber vendor-authorized instruction at our
training centers, online, or onsite.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Cor
Thanks David,

OK, HTTP -> String... that clears a lot!
Can you give a little example of how to do you typically have to serialize
your data to send via HTTP, then deserialize the sent data to use it as an
object that's not a string.

Best regards,
Cor van Dooren


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Dave Watts
Sent: dinsdag 6 september 2011 6:08
To: Flash Coders List
Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL
with PHP

> Do you mean that is it not possible to send an array from Flash to PHP 
> in this way:
>
>        private function validateAndSend(e:MouseEvent):void {
>                form_variables = new URLVariables();
>...
>                form_variables.VALUES = myMultiDimArray;
>                form_varLoader.addEventListener(Event.COMPLETE,
> completeLoadHandler);
>                form_varLoader.load(form_varSend);
>        }

That would send a single form field, VALUES, with a single value containing
something that's not a string. But sending data via HTTP requires that you
use strings. In the simplest case, you'd at least have to convert the array
to a string to store it within the single form field. This kind of thing is
a fairly common problem with web applications - you typically have to
serialize your data to send via HTTP, then deserialize the sent data to use
it as an object that's not a string.

Normally, as an occasional Flex guy, I end up using AMF which includes
serialization/deserialization functionality to handle this for you.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule,
and provides the highest caliber vendor-authorized instruction at our
training centers, online, or onsite.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Cor
Karl,

Thank you very much!!

But this would create a lot of network traffic, open connection and
database, do mysql_query and close db conn??

You wrote in the previous mail:
I should mention that I use this stuff inside php classes. so $this-> has
already been defined as the class your currently in.
Like the database class, $database->addDescription(); is called outside the
class. if it was called inside the database class file, it would be
$this->addDescription();. Also, the php file name thats called from flash is
database.php. etc, etc. FYI.

- a process.php, this retrieves your variables from flash, makes sure its
not a bot, any verify codes checked here, etc
- then send it to your sessions.php for validation and set your errors here
to send back with.
- then send to your database.php for stripping, manipulation and insertion.

This is what I am looking for (to learn) and where my knowledge of PHP
stops...

You can address me directly if you like: codo AT chello DOT nl

Best regards,
Cor van Dooren


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl
DeSaulniers
Sent: dinsdag 6 september 2011 6:07
To: Flash Coders List
Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL
with PHP

I think you may be able to use the php split() or explode() on a array of
data sent.
but probably easier to split it up when gathering the info in flash.
multiple small queries instead of a bulky single query?

Karl


On Sep 5, 2011, at 10:34 PM, Cor wrote:

> Do you mean that is it not possible to send an array from Flash to PHP 
> in this way:
>
>   private function validateAndSend(e:MouseEvent):void {
>   form_variables = new URLVariables();
>   form_varSend=new URLRequest(Main.PHP_URL+"control.php");
>   form_varSend.method=URLRequestMethod.POST;
>   form_varSend.data=form_variables;
>   form_varLoader=new URLLoader  ;
>   form_varLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
>   form_variables.sendRequest = "registreer_materiaal";
>   form_variables.VALUES = myMultiDimArray;
>   form_varLoader.addEventListener(Event.COMPLETE,
> completeLoadHandler); 
>   form_varLoader.load(form_varSend);
>   }
>
>
> -Original Message-
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Dave 
> Watts
> Sent: dinsdag 6 september 2011 5:27
> To: Flash Coders List
> Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to 
> mySQL with PHP
>
>> My problem is how to fetch my $_POST['VALUES'], which is the 
>> multi-dimensional  array:
>>
>> myArray[0["id"]
>>  myArray[0]["name"]
>>  myArray[0]["description"]
>>
>> ...
>>
>> etc.
>
> I'm not a PHP expert, but in general you can't really submit an array 
> as form data directly to a CGI program. You have to post name-value 
> pairs - if you have a set of array values, they'd simply end up having 
> the same name and different values (like a checkbox array in HTML, for 
> example).
> In your
> case, things are a bit more complicated because you have an array of 
> structs, basically, so you'll need to convert those to a bunch of 
> individual name-value pairs in order to submit them to a CGI program.
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> http://training.figleaf.com/
>
> Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA 
> Schedule, and provides the highest caliber vendor-authorized 
> instruction at our training centers, online, or onsite.
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Dave Watts
> Do you mean that is it not possible to send an array from Flash to PHP in
> this way:
>
>        private function validateAndSend(e:MouseEvent):void {
>                form_variables = new URLVariables();
>...
>                form_variables.VALUES = myMultiDimArray;
>                form_varLoader.addEventListener(Event.COMPLETE,
> completeLoadHandler);
>                form_varLoader.load(form_varSend);
>        }

That would send a single form field, VALUES, with a single value
containing something that's not a string. But sending data via HTTP
requires that you use strings. In the simplest case, you'd at least
have to convert the array to a string to store it within the single
form field. This kind of thing is a fairly common problem with web
applications - you typically have to serialize your data to send via
HTTP, then deserialize the sent data to use it as an object that's not
a string.

Normally, as an occasional Flex guy, I end up using AMF which includes
serialization/deserialization functionality to handle this for you.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Karl DeSaulniers
I think you may be able to use the php split() or explode() on a array  
of data sent.

but probably easier to split it up when gathering the info in flash.
multiple small queries instead of a bulky single query?

Karl


On Sep 5, 2011, at 10:34 PM, Cor wrote:

Do you mean that is it not possible to send an array from Flash to  
PHP in

this way:

private function validateAndSend(e:MouseEvent):void {
form_variables = new URLVariables();
form_varSend=new URLRequest(Main.PHP_URL+"control.php");
form_varSend.method=URLRequestMethod.POST;
form_varSend.data=form_variables;
form_varLoader=new URLLoader  ;
form_varLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
form_variables.sendRequest = "registreer_materiaal";
form_variables.VALUES = myMultiDimArray;
form_varLoader.addEventListener(Event.COMPLETE,
completeLoadHandler);   
form_varLoader.load(form_varSend);
}


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Dave  
Watts

Sent: dinsdag 6 september 2011 5:27
To: Flash Coders List
Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash  
to mySQL

with PHP


My problem is how to fetch my $_POST['VALUES'], which is the
multi-dimensional  array:

myArray[0["id"]
 myArray[0]["name"]
 myArray[0]["description"]

...

etc.


I'm not a PHP expert, but in general you can't really submit an  
array as
form data directly to a CGI program. You have to post name-value  
pairs - if
you have a set of array values, they'd simply end up having the same  
name
and different values (like a checkbox array in HTML, for example).  
In your

case, things are a bit more complicated because you have an array of
structs, basically, so you'll need to convert those to a bunch of  
individual

name-value pairs in order to submit them to a CGI program.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA  
Schedule,

and provides the highest caliber vendor-authorized instruction at our
training centers, online, or onsite.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Karl DeSaulniers

Hi Cor,
Have you ever made a mail form in flash?

I am assuming you have. Pretty much same scenario.
Just break down myArray[i] into individual vars and send the variables  
to the php file.

So with a while or for loop, gather all your variables and send away.

Opt 1.
for each set - myArray[0]
- send this set
return to for loop - myArray[1]
- send next set

... etc

Opt 2.
or gather all the individual variables and send all at once. if this  
is your wish.
you will have to set something up on the php side to differentiate  
between myArray[0]['id'] and myArray[1]['id'], etc.


3.
or you can send the array and break it up on the php side with a while  
or for loop


var $ID_Array = array();
for () {
$ID_Array[i] = array();
$this->$ID_Array[i][0] = $_POST[id][0];
(This is not tested, FYI. just the basic gist)

When you use POST in flash, php will automatically fill $_POS[''] with  
the flash form var.

then you just get your var out and put it in that function.

$post_id = $_POST['id'];
$post_name = $_POST['name'];
$post_description = $_POST['description'];

$database_query = $database->addDescription($post_id, $post_name,  
$post_description);


if($database_query){ //True ? False
Success / fail code
other ...
}

I should mention that I use this stuff inside php classes. so $this->  
has already been defined as the class your currently in.
Like the database class, $database->addDescription(); is called  
outside the class. if it was called inside the database class file,
it would be $this->addDescription();. Also, the php file name thats  
called from flash is database.php. etc, etc. FYI.


I would recommend setting up separate php files
- a process.php, this retrieves your variables from flash, makes sure  
its not a bot, any verify codes checked here, etc
- then send it to your sessions.php for validation and set your errors  
here to send back with.
- then send to your database.php for stripping, manipulation and  
insertion.


to send back to flash, use die('Error example') for errors and use a  
status listener in flash

to send results, use the return($result);

A search for php sessions example or php login example would get you a  
workable sample code.


HTH,
Best,
Karl


On Sep 5, 2011, at 10:04 PM, Cor wrote:


Thanks Karl,

Yes, I know.
My problem is how to fetch my $_POST['VALUES'], which is the
multi-dimensional  array:

myArray[0["id"]
myArray[0]["name"]
myArray[0]["description"]

myArray[1["id"]
myArray[1]["name"]
myArray[1]["description"]

myArray[2["id"]
myArray[2]["name"]
myArray[2]["description"]

etc.

Best regards,
Cor van Dooren


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl
DeSaulniers
Sent: dinsdag 6 september 2011 3:54
To: Flash Coders List
Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash  
to mySQL

with PHP

Hi Cor,
Assuming you know enough php to set up the file for connecting to your
database, you can insert into your database with the following  
example.


function addDescription($id, $name, $description) {
//Escape any data being inserted
$id = mysql_real_escape_string($id);
$name = mysql_real_escape_string($name);
$description = mysql_real_escape_string($description);

$query = "INSERT INTO YOUR_TABLE_NAME_HERE VALUES ('".$id."','".
$name."','".description."')";
$_POST['VALUES'];

$result = mysql_query($query, YOUR_CONNECTION) or
die(mysql_error());
return $result; //Returns true or false if error }

HTH,
Best,

Karl


On Sep 5, 2011, at 2:04 PM, Cor wrote:


I have a editable datagrid which I fill from mySQL with PHP.
So far works good.

But when items are changed (edit, added, deleted), I want them to  
save

the data in my mySQL database.
My values are in this multi-dimensional indexed array, which elements
all contain a associative array:

myArray[i]["id"]
myArray[i]["name"]
myArray[i]["description"]

So, can anyone tell/show me a apropriate way to pass this to PHP and
in the php-file how to INSERT or UPDATE this to mySQL?

TIA!
Best regards,
Cor van Dooren


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Cor
Do you mean that is it not possible to send an array from Flash to PHP in
this way:

private function validateAndSend(e:MouseEvent):void {
form_variables = new URLVariables();
form_varSend=new URLRequest(Main.PHP_URL+"control.php");
form_varSend.method=URLRequestMethod.POST;
form_varSend.data=form_variables;
form_varLoader=new URLLoader  ;
form_varLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
form_variables.sendRequest = "registreer_materiaal";
form_variables.VALUES = myMultiDimArray;
form_varLoader.addEventListener(Event.COMPLETE,
completeLoadHandler);   
form_varLoader.load(form_varSend);
}


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Dave Watts
Sent: dinsdag 6 september 2011 5:27
To: Flash Coders List
Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL
with PHP

> My problem is how to fetch my $_POST['VALUES'], which is the 
> multi-dimensional  array:
>
> myArray[0["id"]
>  myArray[0]["name"]
>  myArray[0]["description"]
>
> ...
>
> etc.

I'm not a PHP expert, but in general you can't really submit an array as
form data directly to a CGI program. You have to post name-value pairs - if
you have a set of array values, they'd simply end up having the same name
and different values (like a checkbox array in HTML, for example). In your
case, things are a bit more complicated because you have an array of
structs, basically, so you'll need to convert those to a bunch of individual
name-value pairs in order to submit them to a CGI program.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule,
and provides the highest caliber vendor-authorized instruction at our
training centers, online, or onsite.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Dave Watts
> My problem is how to fetch my $_POST['VALUES'], which is the
> multi-dimensional  array:
>
> myArray[0["id"]
>  myArray[0]["name"]
>  myArray[0]["description"]
>
> ...
>
> etc.

I'm not a PHP expert, but in general you can't really submit an array
as form data directly to a CGI program. You have to post name-value
pairs - if you have a set of array values, they'd simply end up having
the same name and different values (like a checkbox array in HTML, for
example). In your case, things are a bit more complicated because you
have an array of structs, basically, so you'll need to convert those
to a bunch of individual name-value pairs in order to submit them to a
CGI program.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Cor
Thanks Karl,

Yes, I know.
My problem is how to fetch my $_POST['VALUES'], which is the
multi-dimensional  array:

myArray[0["id"]
 myArray[0]["name"]
 myArray[0]["description"]

myArray[1["id"]
 myArray[1]["name"]
 myArray[1]["description"]

myArray[2["id"]
 myArray[2]["name"]
 myArray[2]["description"]

etc.

Best regards,
Cor van Dooren


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl
DeSaulniers
Sent: dinsdag 6 september 2011 3:54
To: Flash Coders List
Subject: Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL
with PHP

Hi Cor,
Assuming you know enough php to set up the file for connecting to your
database, you can insert into your database with the following example.

function addDescription($id, $name, $description) {
//Escape any data being inserted
$id = mysql_real_escape_string($id);
$name = mysql_real_escape_string($name);
$description = mysql_real_escape_string($description);

$query = "INSERT INTO YOUR_TABLE_NAME_HERE VALUES ('".$id."','". 
$name."','".description."')";
$_POST['VALUES'];

$result = mysql_query($query, YOUR_CONNECTION) or
die(mysql_error());
return $result; //Returns true or false if error }

HTH,
Best,

Karl


On Sep 5, 2011, at 2:04 PM, Cor wrote:

> I have a editable datagrid which I fill from mySQL with PHP.
> So far works good.
>
> But when items are changed (edit, added, deleted), I want them to save 
> the data in my mySQL database.
> My values are in this multi-dimensional indexed array, which elements 
> all contain a associative array:
>
> myArray[i]["id"]
> myArray[i]["name"]
> myArray[i]["description"]
>
> So, can anyone tell/show me a apropriate way to pass this to PHP and 
> in the php-file how to INSERT or UPDATE this to mySQL?
>
> TIA!
> Best regards,
> Cor van Dooren
>
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Karl DeSaulniers

Hi Cor,
Assuming you know enough php to set up the file for connecting to your  
database,

you can insert into your database with the following example.

function addDescription($id, $name, $description) {
//Escape any data being inserted
$id = mysql_real_escape_string($id);
$name = mysql_real_escape_string($name);
$description = mysql_real_escape_string($description);

	$query = "INSERT INTO YOUR_TABLE_NAME_HERE VALUES ('".$id."','". 
$name."','".description."')";

$_POST['VALUES'];

$result = mysql_query($query, YOUR_CONNECTION) or die(mysql_error());
return $result; //Returns true or false if error
}

HTH,
Best,

Karl


On Sep 5, 2011, at 2:04 PM, Cor wrote:


I have a editable datagrid which I fill from mySQL with PHP.
So far works good.

But when items are changed (edit, added, deleted), I want them to  
save the

data in my mySQL database.
My values are in this multi-dimensional indexed array, which  
elements all

contain a associative array:

myArray[i]["id"]
myArray[i]["name"]
myArray[i]["description"]

So, can anyone tell/show me a apropriate way to pass this to PHP and  
in the

php-file how to INSERT or UPDATE this to mySQL?

TIA!
Best regards,
Cor van Dooren


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] DataGrid: save multidim arrayfrom Flash to mySQL with PHP

2011-09-05 Thread Cor
I have a editable datagrid which I fill from mySQL with PHP.
So far works good.

But when items are changed (edit, added, deleted), I want them to save the
data in my mySQL database.
My values are in this multi-dimensional indexed array, which elements all
contain a associative array:

myArray[i]["id"]
myArray[i]["name"]
myArray[i]["description"]

So, can anyone tell/show me a apropriate way to pass this to PHP and in the
php-file how to INSERT or UPDATE this to mySQL?

TIA!
Best regards,
Cor van Dooren


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] DataGrid: Expanding vertical Thumb width

2011-09-05 Thread Glen Pike

Hi,

I remember having to hack this in Flash for a list component, you 
should be able to set the style, but you need to use GrantSkinners 
workaround http://gskinner.com/blog/archives/2007/05/variable_scroll.html


Edit your skin, then include Grant's fl.controls.List or whatever - 
that includes Scrollbar code.


Set your width using the setStyle props.

_list.setStyle("scrollBarWidth",40);
_list.setStyle("scrollArrowHeight", 40);

HTH

Glen

On 04/09/2011 21:24, lists...@fo.com wrote:

What is the approach to expand a DataGrid vertical scrollbar's
width (from the standard 15 pixels, to 44 or so, for touchscreens)
in pure AS3 / Flash CS 5?

It looks easy in Flex now
http://www.switchonthecode.com/tutorials/flex-fun-advanced-datagrid-topics


But in Flash/AS3,
directly editing
library>  Component Assets>  ScrollBarSkins>  Scrolltrack_skin
as recommended at
http://help.adobe.com/en_US/ActionScript/3.0_UsingComponentsAS3/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7f4a.html
to change its color and width
does change the color and the width in the library,
but only the color -- not the width at runtime.


Widening scrollThumb_upSkin, et al in the library does show them altered when 
run,
but cut off at the stock 16 pixel width of DataGrid scrolltrack.

Any thoughts?

thanks


// basically straight from livedocs...

import fl.controls.DataGrid;
import fl.controls.dataGridClasses.DataGridColumn;
import fl.data.DataProvider;
import fl.events.DataGridEvent;

function setup ():void
{
 var aDg:DataGrid = new DataGrid();
 addChild(aDg);
 aDg.verticalScrollPolicy="on";

 var nameDGC:DataGridColumn = new DataGridColumn("name");
 nameDGC.sortOptions = Array.CASEINSENSITIVE;
 var scoreDGC:DataGridColumn = new DataGridColumn("score");
 scoreDGC.sortOptions = Array.NUMERIC;
 aDg.addColumn(nameDGC);
 aDg.addColumn(scoreDGC);
 var aDP_array:Array = new Array({name:"clark", score:3135},
{name:"Bill", score:803}, {name:"fc", score:03}, {name:"Bruce",
score:403}, {name:"Peter", score:25})
 aDg.dataProvider = new DataProvider(aDP_array);

 aDg.rowCount = aDg.length - 2;
 aDg.width = 200;

 // also does nothing
 aDg.verticalScrollBar.width = 60;
}
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders