Re: [PHP] Posting values of dynamically generated text fields at a time

2010-07-14 Thread Ashley Sheridan
On Wed, 2010-07-14 at 12:08 +0530, Saravanan Murugesan wrote:

> > Hi is anybody there to help me out on this?
> >
> >>
> >> Hi all,
> >> I am new to PHP and JS.
> >>
> >> I am adding new text fields using javascript and I have to save the
> >> values
> >> of these fields in database in single row. So, how should I post these
> >> values? So that I can save them in the db.
> >>
> >> Additional Info: There are 6 text fields in the row. I have to post the
> >> information of all the fields collectively.
> >>
> >> So, please suggest me a way.
> >> --
> >> Thanks and Regards,
> >> Amit
> >>
> >>
> >
> >
> > --
> > Thanks and Regards,
> > Amit
> > eArth Solutions Pvt. Ltd
> >
> 
> Hi,
> 
> this would help you,
> http://www.w3schools.com/PHP/php_mysql_insert.asp
> 
> Thanks,
> Saravana
> 
> 
> ===
> ***Disclaimer***
> 
> 
> This email, and any attachments ("this email"), is confidential. If you are 
> not the addressee
> please tell the sender immediately, and destroy this email without using, 
> sending or storing
> it. Any opinions, express or implied, in this email, are those of the sender, 
> and are not
> necessarily approved by Hurix Systems. Except as expressly stated, this 
> e-mail should not be
> regarded as an offer, solicitation, recommendation or agreement to buy or 
> sell products or
> services, or to enter into any contract. E-mail transmissions are not secure 
> and may suffer
> errors, viruses, delay, interception and amendment. Hurix Systems does not 
> accept liability
> for damage caused by any of the foregoing.
> 
> HURIX SYSTEMS MAY MONITOR ALL INCOMING AND OUTGOING MAILS
> 
> 


Erm, that's not even remotely an answer to the OPs question...

Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] Static Class Member References

2010-07-14 Thread Ford, Mike
> -Original Message-
> From: Daniel Kolbo [mailto:kolb0...@umn.edu]
> Sent: 11 July 2010 23:19
> 
> Hello PHPers,
> 
> I'm having some trouble understanding some PHP behaviour.  The
> following
> example script exhibits the behaviour which I cannot understand.

I'm pretty sure that this is *not* a bug. I'll answer your last
question first, and then demonstrate with your code.

> I'm nervous to use "self::$a = $this;" because I don't want to be
> copying the whole object.  However, isn't $this just a reference to
> the
> object, so "self::$a = $this;" is just copying the reference and not
> the
> actual object, right?

Not exactly, although everybody seems to refer to it as a reference
for convenience. Most of the time it doesn't matter, but when you
start introducing references to objects it can - it's better to think
of an object variable as holding the object's *handle*
(see http://php.net/anguage.oop5.references.php for more on this), so
it's clear exactly what a reference is referencing.

Now for your code:

> [code]
>  
> class A
> {
>   public static $a = 3;
> 
>   function __construct()
>   {
>   //self::$a = $this; //[i]
>   self::$a =& $this; //[ii]
>   }
> }
> 
> class B extends  A
> {
>   function __construct()
>   {
>   parent::__construct();
>   }
> }
> 
> class C {
>   var $c;
> 
>   function __construct()
>   {
>   $this->c =& A::$a;
>   }
> 
> }
> 
> 
> $c = new C;

[i] & [ii]  in C::__construct(): $c->c = reference to same value as
A::$a (currently (int)3)
NOTE: because of how references work, A::$a is now also a
reference to (int)3.

> $b = new B;

[i]  in A::__construct(): A::$a = handle of object B(1) (also assigned to
 global $b)
 NOTE: $c->c, as reference to $A::a, now also references handle of
   object B(1)

[ii] in A::__construct(): A::$a = reference to handle of object B(1)
 NOTE: since we are assigning a new reference to a variable which is
   already a reference, ONLY this reference changes -- so $c->c
   is still a reference to (int)3...!

> $cee = new C;

Irrelevant -- the damage has already been done!

> var_dump($c->c); // [i] prints object(B), but [ii] prints int 3
> var_dump($cee->c); // [i] prints object(B), and [ii] prints
> object(B)

... which is correct according to my interpretation.

This has been such a regular confusion, that some time ago I wrote
this test script:

me = 'Original';

$copy_t = $t;
$ref_t = &$t;

$copy_t = new test;
$copy_t->me = 'Altered Copy';

echo <me
Reference: $ref_t->me
RESULT1;

$ref_t = new test;
$ref_t->me = 'Altered Reference';

echo <<
Original: $t->me
Copy: $copy_t->me
Reference: $ref_t->me
RESULT2;


$s = 'String';

$copy_s = $s;
$ref_s = &$s;

$copy_s = 'String Copy';

echo <<
Original: $s
Copy: $copy_s
Reference: $ref_s
RESULT3;

$ref_s = 'String Reference';

echo <<
Original: $s
Copy: $copy_s
Reference: $ref_s
RESULT4;

?>

Which gives this output:

Original: Original
Copy: Altered Copy
Reference: Original

Original: Altered Reference
Copy: Altered Copy
Reference: Altered Reference

Original: String
Copy: String Copy
Reference: String

Original: String Reference
Copy: String Copy
Reference: String Reference

Which demonstrates how exactly the behaviour of objects correlates to
scalars with regards to copying and referencing -- but may not be
exactly what you expect if you think of object variables as always
holding a reference to the object. I would heartily recommend always
to think of an object variable as holding the object's *handle*, and
*not* a reference - this may croggle your brain a bit, but makes it a
Lot clearer what's happening in edge cases like this.

Cheers!

Mike

 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.f...@leedsmet.ac.uk 
Tel: +44 113 812 4730





To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Posting values of dynamically generated text fields at a time

2010-07-14 Thread Saravanan Murugesan


Regards,

Saravanan Murugesan
Sr. Media Developer


Hurix Systems Pvt. Ltd
New No.34 / Old No.10, Taylors Road, Kilpauk, Chennai 600010. INDIA
Phone: +91-044-42284888 ext.852
Mobile: +91-9940295951

- Original Message - 
From: "Ashley Sheridan" 

To: 
Cc: "Amit Bobade" ; 
Sent: Wednesday, July 14, 2010 2:00 PM
Subject: Re: [PHP] Posting values of dynamically generated text fields at a 
time




On Wed, 2010-07-14 at 12:08 +0530, Saravanan Murugesan wrote:


> Hi is anybody there to help me out on this?
>
>>
>> Hi all,
>> I am new to PHP and JS.
>>
>> I am adding new text fields using javascript and I have to save the
>> values
>> of these fields in database in single row. So, how should I post these
>> values? So that I can save them in the db.
>>
>> Additional Info: There are 6 text fields in the row. I have to post 
>> the

>> information of all the fields collectively.
>>
>> So, please suggest me a way.
>> --
>> Thanks and Regards,
>> Amit
>>
>>
>
>
> --
> Thanks and Regards,
> Amit
> eArth Solutions Pvt. Ltd
>

Hi,

this would help you,
http://www.w3schools.com/PHP/php_mysql_insert.asp

Thanks,
Saravana


===
***Disclaimer***


This email, and any attachments ("this email"), is confidential. If you 
are not the addressee
please tell the sender immediately, and destroy this email without using, 
sending or storing
it. Any opinions, express or implied, in this email, are those of the 
sender, and are not
necessarily approved by Hurix Systems. Except as expressly stated, this 
e-mail should not be
regarded as an offer, solicitation, recommendation or agreement to buy or 
sell products or
services, or to enter into any contract. E-mail transmissions are not 
secure and may suffer
errors, viruses, delay, interception and amendment. Hurix Systems does 
not accept liability

for damage caused by any of the foregoing.

HURIX SYSTEMS MAY MONITOR ALL INCOMING AND OUTGOING MAILS





Erm, that's not even remotely an answer to the OPs question...

Thanks,
Ash
http://www.ashleysheridan.co.uk




Hi Amit,

I couldn't able understand exactly what your requirement is. I have attached 
a php page, just see whether this helps...


This one generates text fields dynamically in a page and then onSubmit it 
takes the values to DB process...


Thanks,
saravana 



===
***Disclaimer***


This email, and any attachments ("this email"), is confidential. If you are not 
the addressee
please tell the sender immediately, and destroy this email without using, 
sending or storing
it. Any opinions, express or implied, in this email, are those of the sender, 
and are not
necessarily approved by Hurix Systems. Except as expressly stated, this e-mail 
should not be
regarded as an offer, solicitation, recommendation or agreement to buy or sell 
products or
services, or to enter into any contract. E-mail transmissions are not secure 
and may suffer
errors, viruses, delay, interception and amendment. Hurix Systems does not 
accept liability
for damage caused by any of the foregoing.

HURIX SYSTEMS MAY MONITOR ALL INCOMING AND OUTGOING MAILS


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] updating a database

2010-07-14 Thread David Mehler
Hello,
What i'm trying to do certainly doesn't seem hard conceptually, but
coding it has been rough. I'm wondering if anyone has anything
similar.
I've got a database with records. The first time the page is accessed
the submit button won't be selected, so display information about the
record with a checkbox for selection. If a user selects a checkbox and
hits submit, display only that specific record in a form for editing,
once editing is complete feed the edited data back to the database.
I'd like all this to be done in a single sticky file.
If anyone has any code similar to this i'd appreciate getting a look,
mine is nonworking.
Thanks.
Dave.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] updating a database

2010-07-14 Thread Bastien Koert
On Wed, Jul 14, 2010 at 9:59 AM, David Mehler  wrote:
> Hello,
> What i'm trying to do certainly doesn't seem hard conceptually, but
> coding it has been rough. I'm wondering if anyone has anything
> similar.
> I've got a database with records. The first time the page is accessed
> the submit button won't be selected, so display information about the
> record with a checkbox for selection. If a user selects a checkbox and
> hits submit, display only that specific record in a form for editing,
> once editing is complete feed the edited data back to the database.
> I'd like all this to be done in a single sticky file.
> If anyone has any code similar to this i'd appreciate getting a look,
> mine is nonworking.
> Thanks.
> Dave.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Are you passing back the id of the record that you want to see as the
value for the checkbox? It should be a simple matter then of pulling
just that id


-- 

Bastien

Cat, the other other white meat

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] updating a database

2010-07-14 Thread Bob McConnell
From: David Mehler

> What i'm trying to do certainly doesn't seem hard conceptually, but
> coding it has been rough. I'm wondering if anyone has anything
> similar.
> I've got a database with records. The first time the page is accessed
> the submit button won't be selected, so display information about the
> record with a checkbox for selection. If a user selects a checkbox and
> hits submit, display only that specific record in a form for editing,
> once editing is complete feed the edited data back to the database.
> I'd like all this to be done in a single sticky file.
> If anyone has any code similar to this i'd appreciate getting a look,
> mine is nonworking.

Mine looks something like this

-8<---
$Submit   = $_POST['Submit'];

if (isset($CCsubmit)) {
  DELETE
if ($Submit == "Delete") {
// Check to see if user authorized, then delete record

}
  NEW
else if ($Submit == "New" || $Submit == "Next"){
// Issue empty form or next record

}
  EDIT
else if ($Submit == "Save") {
// Validate and ssve the updated data. Reissue if validation
fails.

}
}
else {
// Issue form with initial data



}
-8<---

You should also check in the Save option to see if anything was actually
changed. The record shouldn't be updated if nothing was edited.

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] updating a database

2010-07-14 Thread Ashley Sheridan
On Wed, 2010-07-14 at 10:29 -0400, Bob McConnell wrote:

> From: David Mehler
> 
> > What i'm trying to do certainly doesn't seem hard conceptually, but
> > coding it has been rough. I'm wondering if anyone has anything
> > similar.
> > I've got a database with records. The first time the page is accessed
> > the submit button won't be selected, so display information about the
> > record with a checkbox for selection. If a user selects a checkbox and
> > hits submit, display only that specific record in a form for editing,
> > once editing is complete feed the edited data back to the database.
> > I'd like all this to be done in a single sticky file.
> > If anyone has any code similar to this i'd appreciate getting a look,
> > mine is nonworking.
> 
> Mine looks something like this
> 
> -8<---
> $Submit   = $_POST['Submit'];
> 
> if (isset($CCsubmit)) {
>     DELETE
>   if ($Submit == "Delete") {
>   // Check to see if user authorized, then delete record
> 
>   }
>     NEW
>   else if ($Submit == "New" || $Submit == "Next"){
>   // Issue empty form or next record
> 
>   }
>     EDIT
>   else if ($Submit == "Save") {
> // Validate and ssve the updated data. Reissue if validation
> fails.
> 
> }
> }
> else {
> // Issue form with initial data
> 
> 
> 
> }
> -8<---
> 
> You should also check in the Save option to see if anything was actually
> changed. The record shouldn't be updated if nothing was edited.
> 
> Bob McConnell
> 


David, are you looking for something broad or specific? phpMyAdmin does
what you want, so might be a good starting point?

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] Problem when adding special characters to an XML file

2010-07-14 Thread te0t3l
Hi, I'm editing an XML file through a form:

$XML = new DOMDocument('1.0', 'UTF-8');
$XML->preserveWhiteSpace = false;
$XML->load("../xml/exposiciones.xml");
$raiz = $XML->documentElement;

$nodoContenedor = $XML->getElementsByTagName('texto');
foreach ($nodoContenedor as $NuevoNodo)
{
//titulo
$nodoTitulo = $XML->createElement("p",
""$titulo"");
$NuevoNodo->appendChild($nodoTitulo);
$nodoTitulo->setAttribute("class", "titulo");
$NuevoNodoHijo = $XML->createElement("subtitulo", "
$subtitulo");
$nodoTitulo->appendChild($NuevoNodoHijo);
$raiz->appendChild($NuevoNodo);
}

$NodoRefTitulo = $XML->getElementsByTagName('p')->item(0);
$NodoRefTitulo->parentNode->insertBefore($nodoTitulo, $NodoRefTitulo);
$XML->formatOutput = true;
$XML->save("../xml/exposiciones.xml");


The problem is that the special characters that I introduce through the form
(á,é,ó...) corrupt the XML file, and when I try to update again the file,
receipted this error:

Warning: DOMDocument::load() [domdocument.load]: Input is not proper UTF-8,
indicate encoding ! Bytes: 0xF3 0x6E 0x20 0x63 in

I'd try to fix up it with the label , and by changing the
encoding -> UTF-8, iso-8859-1 as well,

here: $XML = new DOMDocument('1.0', 'UTF-8'); --> $XML = new
DOMDocument('1.0', 'iso-8859-1');

and in the XML file:

 .

and also I was try:

$subtitulo = str_replace("ó" , "ó", utf8_encode($subtitulo));
$subtitulo = str_replace("ó" , "ó;", utf8_encode($subtitulo));

When I open the XML file again i found an strange character between "i" and
"n" exposicion (exposición):

"A-foto" *exposiciﻩn*colectiva.


Anyone know how to solve this problem?

Thanks for your help,

Te0


Re: [PHP] Static Class Member References

2010-07-14 Thread David Harkness
Ah, so assigning a reference to a variable already holding a reference
changes that variable's reference only in the same way that unsetting a
reference doesn't unset the other variables referencing the same thing, yes?

$a = 5;
$b = &$a;
print $a;
> 5
unset($b);  // does not affect $a
print $a;
> 5

// and according to Mike's previous message
$b = &$a;
$c = 10;
$b = &$c;  // does not affect $a
print $a
> 5

That makes a lot of sense. If it didn't work this way there would be no easy
way to untangle references. In the case of

foreach($array as $key => &$value) { ... }

the first value in the array would continuously be overwritten by the next
value.

1. $value gets reference to first array value
2. on each step through the loop, the first array value would be overwritten
by the next value in the loop since $value is forever tied to it by the
initial reference assignment.

That would be a Bad Thing (tm).

Thanks for the clarification, Mike.

David


RE: [PHP] updating a database

2010-07-14 Thread Tommy Pham
> -Original Message-
> From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
> Sent: Wednesday, July 14, 2010 11:29 AM
> To: Bob McConnell
> Cc: David Mehler; php-general
> Subject: RE: [PHP] updating a database
> 
> On Wed, 2010-07-14 at 10:29 -0400, Bob McConnell wrote:
> 
> > From: David Mehler
> >
> > > What i'm trying to do certainly doesn't seem hard conceptually, but
> > > coding it has been rough. I'm wondering if anyone has anything
> > > similar.
> > > I've got a database with records. The first time the page is
> > > accessed the submit button won't be selected, so display information
> > > about the record with a checkbox for selection. If a user selects a
> > > checkbox and hits submit, display only that specific record in a
> > > form for editing, once editing is complete feed the edited data back to
> the database.
> > > I'd like all this to be done in a single sticky file.
> > > If anyone has any code similar to this i'd appreciate getting a
> > > look, mine is nonworking.
> >
> > Mine looks something like this
> >
> > -8<---
> > $Submit   = $_POST['Submit'];
> >
> > if (isset($CCsubmit)) {
> >   DELETE
> > if ($Submit == "Delete") {
> > // Check to see if user authorized, then delete record
> >
> > }
> >   NEW
> > else if ($Submit == "New" || $Submit == "Next"){
> > // Issue empty form or next record
> >
> > }
> >   EDIT
> > else if ($Submit == "Save") {
> > // Validate and ssve the updated data. Reissue if
> > validation fails.
> >
> > }
> > }
> > else {
> > // Issue form with initial data
> >
> >
> >
> > }
> > -8<---
> >
> > You should also check in the Save option to see if anything was
> > actually changed. The record shouldn't be updated if nothing was edited.
> >
> > Bob McConnell
> >
> 
> 
> David, are you looking for something broad or specific? phpMyAdmin does
> what you want, so might be a good starting point?
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 

I think David is looking for a solution to edit a row from a specific query in 
his own app where the authorized user will edit the selected row.  There are 
several ways to accomplished this.

1) The fancy and less strain on the servers is via AJAX call.  When the user 
click on the check box or some kind of button (link or form type), your 
javascript function will send that particular id back to server and load all 
the relevant info for editing in a div tag.  Your div tag containing the form 
can then do update provided that it passes all the sanity and validation check. 
 Upon the successful update, your code can then reload the table with the 
updated data.

2) The straight forward way is to use the same checkbox or button and submit 
the form (via onclick).  That same page will detect the id and load all the 
relevant info and show the editing form via php's if or include.  After the 
user submit the edit form and the data passes the sanity and validation check, 
your same PHP page can update the data and reload the updated data to display 
in the table.  When you load the edit form, you can choose to display the 
original table data or not.  If you do, it would create unnecessary strain on 
the servers, IMO.

3) Do #2 but implement caching to reduce the strain on the servers.  This 
method will require you to maintain the cache for the updated data.

You'll have to look at your application design, the features & functionality of 
the site/application, your skillset (PHP, Javascript, XML, etc) and choose what 
you think is best.

Regards,
Tommy


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Malformed UTF-8 Data in JSON

2010-07-14 Thread Dave M G

PHP Users,

I'm decoding some JSON data in PHP to convert it into an array.

However, it's not working, and json_last_error() is returning a value of 
"4", which I believe means "Malformed UTF-8 characters, possibly 
incorrectly encoded".


I try at every turn in every setting to ensure that all my code and 
connections are in UTF-8.


But how can I be sure it's valid UTF-8? I've tried using the PHP command 
utf8_encode() on the string, but that hasn't changed anything.


And can I trust the error message?

Any help or advice would be much appreciated.

By the way, here is the code I'm currently testing with. I'm just 
encoding and then decoding a string right in the PHP just to get it to 
work before I even try getting the data from anywhere else.


$myData ='{"display_name":"Test
Guy","email":"test...@testaddress.com","timeout":"1279145273"}';
$myArray1 = json_encode($myData);
$myArray2 = utf8_encode (stripslashes($myArray1));
$myArray = json_decode($myArray2, true);
$jsonerror = json_last_error();

--
Dave M G

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Malformed UTF-8 Data in JSON

2010-07-14 Thread Jim Lucas
Dave M G wrote:
> PHP Users,
> 
> I'm decoding some JSON data in PHP to convert it into an array.
> 
> However, it's not working, and json_last_error() is returning a value of
> "4", which I believe means "Malformed UTF-8 characters, possibly
> incorrectly encoded".
> 
> I try at every turn in every setting to ensure that all my code and
> connections are in UTF-8.
> 
> But how can I be sure it's valid UTF-8? I've tried using the PHP command
> utf8_encode() on the string, but that hasn't changed anything.
> 
> And can I trust the error message?
> 
> Any help or advice would be much appreciated.
> 
> By the way, here is the code I'm currently testing with. I'm just
> encoding and then decoding a string right in the PHP just to get it to
> work before I even try getting the data from anywhere else.
> 
> $myData ='{"display_name":"Test
> Guy","email":"test...@testaddress.com","timeout":"1279145273"}';
> $myArray1 = json_encode($myData);
> $myArray2 = utf8_encode (stripslashes($myArray1));
> $myArray = json_decode($myArray2, true);
> $jsonerror = json_last_error();
> 

Were you meaning to strip the slashes??  That will break things...  They are
their for a reason.  :)

Try it without that stripslashes() and see what happens.

Also, if on that error page they are using a bitwise numbering scheme it would
not be the last one, it would be the third error message

Value   Constant
1   JSON_ERROR_NONE
2   JSON_ERROR_DEPTH
4   JSON_ERROR_CTRL_CHAR
8   JSON_ERROR_SYNTAX
16  JSON_ERROR_UTF8

Just to be sure, echo each of the above constants and see what the value is.

And, if my suspicion is correct it is going to be because when you stripslashes
and then try and decode it, it breaks because the escaped characters are not
longer escaped.

My suggestion would be to UTF*_encode() each piece of data before you stuff it
into your json string.  Then one you have built your json string from the
encoded data, run it through json_encode() and you should be fine.

2 pennies for my thoughts please... :)

-- 
Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Static Class Member References

2010-07-14 Thread Daniel Kolbo


David Harkness wrote:
> Ah, so assigning a reference to a variable already holding a reference
> changes that variable's reference only in the same way that unsetting a
> reference doesn't unset the other variables referencing the same thing, yes?
> 
> $a = 5;
> $b = &$a;
> print $a;
>> 5
> unset($b);  // does not affect $a
> print $a;
>> 5
> 
> // and according to Mike's previous message
> $b = &$a;
> $c = 10;
> $b = &$c;  // does not affect $a
> print $a
>> 5
> 
> That makes a lot of sense. If it didn't work this way there would be no easy
> way to untangle references. In the case of
> 
> foreach($array as $key => &$value) { ... }
> 
> the first value in the array would continuously be overwritten by the next
> value.
> 
> 1. $value gets reference to first array value
> 2. on each step through the loop, the first array value would be overwritten
> by the next value in the loop since $value is forever tied to it by the
> initial reference assignment.
> 
> That would be a Bad Thing (tm).
> 
> Thanks for the clarification, Mike.
> 
> David
> 

The big "aha" moment for was when realizing that when assigning a
reference to a variable you only change its reference and not any other
variable that may also have shared the same reference.  Yuck that's a
mouth full.  This happened when Mike said, " NOTE: since we are
assigning a new reference to a variable which is already a reference,
ONLY this reference changes".

Yes, i agree with you David (on both of your points).  Thanks for the
example using the unset.  This further clarified/solidified my
understanding.

Now, with this new understanding, I also wish to comment that if i
assign (without reference) $this, i don't have to be too worried about
bloating the memory, b/c i'm only assigning/copying the identifer or
*handle* and not the actual object itself.

In case, someone reads this in the archive the link is:
http://php.net/manual/en/language.oop5.references.php

Mike, thank you a ton.

Regards.
`

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Malformed UTF-8 Data in JSON [SOLVED]

2010-07-14 Thread Dave M G

Jim,

Thank you for responding.

Yes, stripslashes() was the problem. I've removed it and the code works.

However, it seems that when I send JSON data from a Javascript file, 
stripslashes() is necessary. That's why I had it there. I'm not entirely 
sure what's going on there, so obviously more experimentation is needed.


In any case, your suggestion has got me on the next step, so thanks for 
that tip. I'll add 2 cents to your tab!


--
Dave M G

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to alter the schema of a database to introduce new features or change the current features

2010-07-14 Thread Slith One
I'm developing an app using Zend Framwork using Git for version control.

What is the best approach for updating the schema and the database
when one of us makes an update to the db structure?

currently, we have to blow out the tables and recreate them manually
to reflect the new updates.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to alter the schema of a database to introduce new features or change the current features

2010-07-14 Thread Paul M Foster
On Wed, Jul 14, 2010 at 09:28:53PM -0700, Slith One wrote:

> I'm developing an app using Zend Framwork using Git for version control.
> 
> What is the best approach for updating the schema and the database
> when one of us makes an update to the db structure?
> 
> currently, we have to blow out the tables and recreate them manually
> to reflect the new updates.

I'm probably being naive, but don't you have an ALTER TABLE sql
statement available to you?

Also, for what it's worth, I don't build tables manually (at the command
line or whatever). I always create a script which will build the tables
I need. If, for some crazy reason, I do have to restart from scratch,
it's a simple matter to alter that script and re-run it.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Malformed UTF-8 Data in JSON [SOLVED]

2010-07-14 Thread Benjamin Hawkes-Lewis
On 15 Jul 2010, at 04:12, Dave M G wrote:
> Yes, stripslashes() was the problem. I've removed it and the code works.
> 
> However, it seems that when I send JSON data from a Javascript file, 
> stripslashes() is necessary. That's why I had it there. I'm not entirely sure 
> what's going on there, so obviously more experimentation is needed.

Presumably, thanks to your PHP settings, you need stripslashes() on all $_GET, 
$_POST, and $_COOKIE input.

http://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc

This does not apply to input from other sources.

--
Benjamin Hawkes-Lewis
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php