php-general Digest 3 Jul 2010 07:02:08 -0000 Issue 6828

Topics (messages 306643 through 306659):

complex unf8 indic script rendering and cairo
        306643 by: shiplu

Re: Delegating variable-length argument lists
        306644 by: Adam Richardson

Re: php processing name vs. id field
        306645 by: Adam Richardson
        306646 by: Peter Lind
        306647 by: Adam Richardson
        306648 by: Peter Lind

CFP for Surge Scalability Conference 2010
        306649 by: Jason Dixon

SELECT AVG(rating)
        306650 by: Ben Miller
        306651 by: Ashley Sheridan
        306652 by: Ben Miller

What's wrong in this function? Does not work for me.
        306653 by: Carlos Sura
        306654 by: Ashley Sheridan
        306655 by: Carlos Sura
        306656 by: Ashley Sheridan
        306659 by: Alexandre Simon

Re: mail() + localhost
        306657 by: Manuel Lemos

Re: how to use HTML Symbol Entities with mail() ?
        306658 by: Manuel Lemos

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 ---
Anyone knows where I can find cairo (http://www.php.net/cairo) examples.

The php sites doesn't have any example or tutorial.

I am looking for a way to render complex unf8 indic script. Cairo
seems a solution for me though I haven't tried yet.

if you have any suggestion on complex indic script rendering that'll be great.

Thanks

Shiplu Mokadd.im
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

--- End Message ---
--- Begin Message ---
On Fri, Jul 2, 2010 at 11:49 AM, Jakob Günther <[email protected]> wrote:

>
> I did not find a solution, so i tried passing a array with references.
>
> $arr = array(&$a, &$b);
> bind_param("ii", $arr);
>
> function bind_param($types, $arr){
>        array_unshift($arr, $types);
>        call_user_func_array (array ($stmt, 'bind_param'), $arr);
> }
>
> This worked in a test-case in one file. But if i call the bind-param-method
> from another class it did not work. Do you have any suggestions on this?
>
>
> Am 02.07.2010 17:25, schrieb Jakob Günther:
> > Hi,
> >
> > i'm writing a custom wrapper for the mysqli_stmt class. I have to
> > override the method mysqli_stmt::bind_param. This function uses
> > "variable-length argument lists". In my function i want to delegate its
> > arguments to the original function.
> >
> > My first naiv implementation was that:
> >
> > function bind_param($types) {
> >       $sParams=array();
> >         $first=true;
> >         for($i=1; i < func_num_args(); $i++) {
> >             $sParams[] = func_get_arg($i);
> >         }
> >
> >       array_unshift ($sParams ,$types);
> >         call_user_func_array (array ($this->mysqli_stmt, 'bind_param'),
> >               $sParams);
> > }
> >
> > But this is not working, because  I need to pass it by reference. Is
> > there a way to retrieve references to a variable number of arguments?
> >
> > Thx, Jakob
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Hi Jakob,

Try looking at this page:
http://www.php.net/manual/en/mysqli-stmt.bind-param.php

Specifically, search for a comment by 'gregg at mochabomb dot com', in which
Gregg presents a simple wrapper class and deals with the referencing issue
the same way you did, by setting array values by reference.

I point this out as perhaps seeing the code will give you a clue as to why
your code had issues in your second test.  If you want help figuring out
what's causing trouble, try posting some of the other code (at least the
class and instance vars, connection method, and the query method(s))
contained within the class.

Adam

P.S. Sorry for the duplicate reply, Jakob, I forgot to reply to the entire
list the first time :(

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

--- End Message ---
--- Begin Message ---
On Fri, Jul 2, 2010 at 12:28 PM, <[email protected]> wrote:

> "Bob McConnell" <[email protected]> wrote on 07/02/2010 08:53:30 AM:
>
> > > Arguments against using/dismissing the "name" attribute in tags is
> > > simply nonsense.
> >
> > This discussion began when I pointed out that the name attribute is
> > deprecated in XHTML. This was later confirmed when someone pointed to
> > the actual specification at <http://www.w3.org/TR/xhtml1/>, however
> > there may be some confusion about the scope of the change. The
> > applicable section is shown below. Apparently HTML 5 is planning to take
> > a different path. Of course, nobody knows that for sure since the spec
> > is far from complete and will likely be undergoing major changes for
> > several more years.
> >
> > Bob McConnell
> >
> > -----8<------------------------------------------------
> > 4.10. The elements with 'id' and 'name' attributes
> >
> > HTML 4 defined the name attribute for the elements a, applet, form,
> > frame, iframe, img, and map. HTML 4 also introduced the id attribute.
> > Both of these attributes are designed to be used as fragment
> > identifiers.
> >
> > In XML, fragment identifiers are of type ID, and there can only be a
> > single attribute of type ID per element. Therefore, in XHTML 1.0 the id
> > attribute is defined to be of type ID. In order to ensure that XHTML 1.0
> > documents are well-structured XML documents, XHTML 1.0 documents MUST
> > use the id attribute when defining fragment identifiers on the elements
> > listed above. See the HTML Compatibility Guidelines for information on
> > ensuring such anchors are backward compatible when serving XHTML
> > documents as media type text/html.
> >
> > Note that in XHTML 1.0, the name attribute of these elements is formally
> > deprecated, and will be removed in a subsequent version of XHTML.
>
> At the risk of injecting a little light into this discussion ;) note the
> list of elements in the excerpt Bob provided: a, applet, form, frame,
> iframe, img, and map. Almost all replies to date have referred to the name
> attribute of the *form elements*: input, select, and textarea. Two
> different sets of elements.
>
> As far as I am concerned, the "authorities" are free to remove the name
> attribute from the first set. I think it is safe to say that the name
> attribute will not be removed from the *form elements* anytime soon.
>
> For all with a holiday coming up this weekend, have a good one!
>
> Kirk


Hi Kirk,

You beat me to it, that's exactly the issue at hand in this debate.  Name IS
deprecated (both in newer versions of HTML and XHTML) for those particular
elements:
http://derickrethans.nl/html-name-attribute-deprecated.html

As Derrick points out on that page, "always read the specs carefully" ;)

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

--- End Message ---
--- Begin Message ---
On 2 July 2010 19:52, Adam Richardson <[email protected]> wrote:
> On Fri, Jul 2, 2010 at 12:28 PM, <[email protected]> wrote:
>
>> "Bob McConnell" <[email protected]> wrote on 07/02/2010 08:53:30 AM:
>>
>> > > Arguments against using/dismissing the "name" attribute in tags is
>> > > simply nonsense.
>> >
>> > This discussion began when I pointed out that the name attribute is
>> > deprecated in XHTML. This was later confirmed when someone pointed to
>> > the actual specification at <http://www.w3.org/TR/xhtml1/>, however
>> > there may be some confusion about the scope of the change. The
>> > applicable section is shown below. Apparently HTML 5 is planning to take
>> > a different path. Of course, nobody knows that for sure since the spec
>> > is far from complete and will likely be undergoing major changes for
>> > several more years.
>> >
>> > Bob McConnell
>> >
>> > -----8<------------------------------------------------
>> > 4.10. The elements with 'id' and 'name' attributes
>> >
>> > HTML 4 defined the name attribute for the elements a, applet, form,
>> > frame, iframe, img, and map. HTML 4 also introduced the id attribute.
>> > Both of these attributes are designed to be used as fragment
>> > identifiers.
>> >
>> > In XML, fragment identifiers are of type ID, and there can only be a
>> > single attribute of type ID per element. Therefore, in XHTML 1.0 the id
>> > attribute is defined to be of type ID. In order to ensure that XHTML 1.0
>> > documents are well-structured XML documents, XHTML 1.0 documents MUST
>> > use the id attribute when defining fragment identifiers on the elements
>> > listed above. See the HTML Compatibility Guidelines for information on
>> > ensuring such anchors are backward compatible when serving XHTML
>> > documents as media type text/html.
>> >
>> > Note that in XHTML 1.0, the name attribute of these elements is formally
>> > deprecated, and will be removed in a subsequent version of XHTML.
>>
>> At the risk of injecting a little light into this discussion ;) note the
>> list of elements in the excerpt Bob provided: a, applet, form, frame,
>> iframe, img, and map. Almost all replies to date have referred to the name
>> attribute of the *form elements*: input, select, and textarea. Two
>> different sets of elements.
>>
>> As far as I am concerned, the "authorities" are free to remove the name
>> attribute from the first set. I think it is safe to say that the name
>> attribute will not be removed from the *form elements* anytime soon.
>>
>> For all with a holiday coming up this weekend, have a good one!
>>
>> Kirk
>
>
> Hi Kirk,
>
> You beat me to it, that's exactly the issue at hand in this debate.  Name IS
> deprecated (both in newer versions of HTML and XHTML) for those particular
> elements:
> http://derickrethans.nl/html-name-attribute-deprecated.html
>
> As Derrick points out on that page, "always read the specs carefully" ;)
>

That was pointed out more than a day ago ...


-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
</hype>

--- End Message ---
--- Begin Message ---
On Fri, Jul 2, 2010 at 1:59 PM, Peter Lind <[email protected]> wrote:

> On 2 July 2010 19:52, Adam Richardson <[email protected]> wrote:
> > On Fri, Jul 2, 2010 at 12:28 PM, <[email protected]> wrote:
> >
> >> "Bob McConnell" <[email protected]> wrote on 07/02/2010 08:53:30 AM:
> >>
> >> > > Arguments against using/dismissing the "name" attribute in tags is
> >> > > simply nonsense.
> >> >
> >> > This discussion began when I pointed out that the name attribute is
> >> > deprecated in XHTML. This was later confirmed when someone pointed to
> >> > the actual specification at <http://www.w3.org/TR/xhtml1/>, however
> >> > there may be some confusion about the scope of the change. The
> >> > applicable section is shown below. Apparently HTML 5 is planning to
> take
> >> > a different path. Of course, nobody knows that for sure since the spec
> >> > is far from complete and will likely be undergoing major changes for
> >> > several more years.
> >> >
> >> > Bob McConnell
> >> >
> >> > -----8<------------------------------------------------
> >> > 4.10. The elements with 'id' and 'name' attributes
> >> >
> >> > HTML 4 defined the name attribute for the elements a, applet, form,
> >> > frame, iframe, img, and map. HTML 4 also introduced the id attribute.
> >> > Both of these attributes are designed to be used as fragment
> >> > identifiers.
> >> >
> >> > In XML, fragment identifiers are of type ID, and there can only be a
> >> > single attribute of type ID per element. Therefore, in XHTML 1.0 the
> id
> >> > attribute is defined to be of type ID. In order to ensure that XHTML
> 1.0
> >> > documents are well-structured XML documents, XHTML 1.0 documents MUST
> >> > use the id attribute when defining fragment identifiers on the
> elements
> >> > listed above. See the HTML Compatibility Guidelines for information on
> >> > ensuring such anchors are backward compatible when serving XHTML
> >> > documents as media type text/html.
> >> >
> >> > Note that in XHTML 1.0, the name attribute of these elements is
> formally
> >> > deprecated, and will be removed in a subsequent version of XHTML.
> >>
> >> At the risk of injecting a little light into this discussion ;) note the
> >> list of elements in the excerpt Bob provided: a, applet, form, frame,
> >> iframe, img, and map. Almost all replies to date have referred to the
> name
> >> attribute of the *form elements*: input, select, and textarea. Two
> >> different sets of elements.
> >>
> >> As far as I am concerned, the "authorities" are free to remove the name
> >> attribute from the first set. I think it is safe to say that the name
> >> attribute will not be removed from the *form elements* anytime soon.
> >>
> >> For all with a holiday coming up this weekend, have a good one!
> >>
> >> Kirk
> >
> >
> > Hi Kirk,
> >
> > You beat me to it, that's exactly the issue at hand in this debate.  Name
> IS
> > deprecated (both in newer versions of HTML and XHTML) for those
> particular
> > elements:
> > http://derickrethans.nl/html-name-attribute-deprecated.html
> >
> > As Derrick points out on that page, "always read the specs carefully" ;)
> >
>
> That was pointed out more than a day ago ...
>
>
> --
> <hype>
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> BeWelcome/Couchsurfing: Fake51
> Twitter: http://twitter.com/kafe15
> </hype>
>

Sorry, Peter,

I didn't realize you'd addressed this in a previous message.  I saw the new
messages today and wanted to make sure the distinction had been made.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

--- End Message ---
--- Begin Message ---
On 2 July 2010 20:03, Adam Richardson <[email protected]> wrote:
> On Fri, Jul 2, 2010 at 1:59 PM, Peter Lind <[email protected]> wrote:
>
>> On 2 July 2010 19:52, Adam Richardson <[email protected]> wrote:
>> > On Fri, Jul 2, 2010 at 12:28 PM, <[email protected]> wrote:
>> >
>> >> "Bob McConnell" <[email protected]> wrote on 07/02/2010 08:53:30 AM:
>> >>
>> >> > > Arguments against using/dismissing the "name" attribute in tags is
>> >> > > simply nonsense.
>> >> >
>> >> > This discussion began when I pointed out that the name attribute is
>> >> > deprecated in XHTML. This was later confirmed when someone pointed to
>> >> > the actual specification at <http://www.w3.org/TR/xhtml1/>, however
>> >> > there may be some confusion about the scope of the change. The
>> >> > applicable section is shown below. Apparently HTML 5 is planning to
>> take
>> >> > a different path. Of course, nobody knows that for sure since the spec
>> >> > is far from complete and will likely be undergoing major changes for
>> >> > several more years.
>> >> >
>> >> > Bob McConnell
>> >> >
>> >> > -----8<------------------------------------------------
>> >> > 4.10. The elements with 'id' and 'name' attributes
>> >> >
>> >> > HTML 4 defined the name attribute for the elements a, applet, form,
>> >> > frame, iframe, img, and map. HTML 4 also introduced the id attribute.
>> >> > Both of these attributes are designed to be used as fragment
>> >> > identifiers.
>> >> >
>> >> > In XML, fragment identifiers are of type ID, and there can only be a
>> >> > single attribute of type ID per element. Therefore, in XHTML 1.0 the
>> id
>> >> > attribute is defined to be of type ID. In order to ensure that XHTML
>> 1.0
>> >> > documents are well-structured XML documents, XHTML 1.0 documents MUST
>> >> > use the id attribute when defining fragment identifiers on the
>> elements
>> >> > listed above. See the HTML Compatibility Guidelines for information on
>> >> > ensuring such anchors are backward compatible when serving XHTML
>> >> > documents as media type text/html.
>> >> >
>> >> > Note that in XHTML 1.0, the name attribute of these elements is
>> formally
>> >> > deprecated, and will be removed in a subsequent version of XHTML.
>> >>
>> >> At the risk of injecting a little light into this discussion ;) note the
>> >> list of elements in the excerpt Bob provided: a, applet, form, frame,
>> >> iframe, img, and map. Almost all replies to date have referred to the
>> name
>> >> attribute of the *form elements*: input, select, and textarea. Two
>> >> different sets of elements.
>> >>
>> >> As far as I am concerned, the "authorities" are free to remove the name
>> >> attribute from the first set. I think it is safe to say that the name
>> >> attribute will not be removed from the *form elements* anytime soon.
>> >>
>> >> For all with a holiday coming up this weekend, have a good one!
>> >>
>> >> Kirk
>> >
>> >
>> > Hi Kirk,
>> >
>> > You beat me to it, that's exactly the issue at hand in this debate.  Name
>> IS
>> > deprecated (both in newer versions of HTML and XHTML) for those
>> particular
>> > elements:
>> > http://derickrethans.nl/html-name-attribute-deprecated.html
>> >
>> > As Derrick points out on that page, "always read the specs carefully" ;)
>> >
>>
>> That was pointed out more than a day ago ...
>>
>>
>> --
>> <hype>
>> WWW: http://plphp.dk / http://plind.dk
>> LinkedIn: http://www.linkedin.com/in/plind
>> BeWelcome/Couchsurfing: Fake51
>> Twitter: http://twitter.com/kafe15
>> </hype>
>>
>
> Sorry, Peter,
>
> I didn't realize you'd addressed this in a previous message.  I saw the new
> messages today and wanted to make sure the distinction had been made.
>

And on that notion, let me apologize for my obvious overreaction. It's
great that people are so helpful here :)

Regards
Peter


-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
</hype>

--- End Message ---
--- Begin Message ---
A quick reminder that there's one week left to submit your abstract for
this year's Surge Scalability Conference.  The event is taking place on
Sept 30 and Oct 1, 2010 in Baltimore, MD.  Surge focuses on case studies
that address production failures and the re-engineering efforts that led
to victory in Web Applications or Internet Architectures.

Our Keynote speakers include John Allspaw and Theo Schlossnagle.  We are
currently accepting submissions for the Call For Papers through July
9th.  You can find more information, including suggested topics and our
current list of speakers, online:

http://omniti.com/surge/2010

I'd also like to urge folks who are planning to attend, to get your
session passes sooner rather than later.  We have limited seating and we
are on track to sell out early.  For more information, including the
CFP, sponsorship of the event, or participating as an exhibitor, please
visit the Surge website or contact us at [email protected].

Thanks,

-- 
Jason Dixon
OmniTI Computer Consulting, Inc.
[email protected]
443.325.1357 x.241

--- End Message ---
--- Begin Message ---
Hi - I have a MySQL table full of product reviews and I'm trying to select
info for only the top 5 rated products.  The only way I can figure out how
to do it so far is something like:

$query1 = mysql_query("SELECT * FROM products");
for($i=1;$i<=mysql_num_rows($query1);$i++) {
        $row1 = mysql_fetch_array($query1,MYSQL_ASSOC);
        $query2 = mysql_query("SELECT AVG(rating) as rating FROM reviews
WHERE product_id='" . $row1['product_id'] . "'");
        ...
        $product[$i]['name'] = $row1['product_name'];
        $product[$i]['rating'] = $row2['rating'];
}

And then use array functions to sort and display only the first 5.

Is there any easier way to get this done with a single query - something
like "SELECT AVG(rating) WHERE product_id=DISTINCT(product_id)"? <<= I tried
that - it didn't work.  Would greatly appreciate any advice.  Thanks,

Ben 



--- End Message ---
--- Begin Message ---
On Fri, 2010-07-02 at 14:32 -0600, Ben Miller wrote:

> Hi - I have a MySQL table full of product reviews and I'm trying to select
> info for only the top 5 rated products.  The only way I can figure out how
> to do it so far is something like:
> 
> $query1 = mysql_query("SELECT * FROM products");
> for($i=1;$i<=mysql_num_rows($query1);$i++) {
>       $row1 = mysql_fetch_array($query1,MYSQL_ASSOC);
>       $query2 = mysql_query("SELECT AVG(rating) as rating FROM reviews
> WHERE product_id='" . $row1['product_id'] . "'");
>       ...
>       $product[$i]['name'] = $row1['product_name'];
>       $product[$i]['rating'] = $row2['rating'];
> }
> 
> And then use array functions to sort and display only the first 5.
> 
> Is there any easier way to get this done with a single query - something
> like "SELECT AVG(rating) WHERE product_id=DISTINCT(product_id)"? <<= I tried
> that - it didn't work.  Would greatly appreciate any advice.  Thanks,
> 
> Ben 
> 
> 
> 


How about something like this (untested)

SELECT products.product_id, AVG(reviews.rating) AS rating
FROM products
LEFT JOIN reviews ON (reviews.product_id = products.product_id)
GROUP BY products.product_id
ORDER BY rating
LIMIT 1,5

I'm unsure about that order and limit there, so you might have to wrap
that inside of a temporary table query and take your 5 out of that. A
join is the right way to go with this though I reckon.

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



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

-----Original Message-----
From: Ashley Sheridan [mailto:[email protected]] 
Sent: Friday, July 02, 2010 2:43 PM
To: [email protected]
Cc: [email protected]
Subject: Re: [PHP] SELECT AVG(rating)

On Fri, 2010-07-02 at 14:32 -0600, Ben Miller wrote:

> Hi - I have a MySQL table full of product reviews and I'm trying to select
> info for only the top 5 rated products.  The only way I can figure out how
> to do it so far is something like:
> 
> $query1 = mysql_query("SELECT * FROM products");
> for($i=1;$i<=mysql_num_rows($query1);$i++) {
>       $row1 = mysql_fetch_array($query1,MYSQL_ASSOC);
>       $query2 = mysql_query("SELECT AVG(rating) as rating FROM reviews
> WHERE product_id='" . $row1['product_id'] . "'");
>       ...
>       $product[$i]['name'] = $row1['product_name'];
>       $product[$i]['rating'] = $row2['rating'];
> }
> 
> And then use array functions to sort and display only the first 5.
> 
> Is there any easier way to get this done with a single query - something
> like "SELECT AVG(rating) WHERE product_id=DISTINCT(product_id)"? <<= I
tried
> that - it didn't work.  Would greatly appreciate any advice.  Thanks,
> 
> Ben 
> 
> 
> 


How about something like this (untested)

SELECT products.product_id, AVG(reviews.rating) AS rating
FROM products
LEFT JOIN reviews ON (reviews.product_id = products.product_id)
GROUP BY products.product_id
ORDER BY rating
LIMIT 1,5

I'm unsure about that order and limit there, so you might have to wrap
that inside of a temporary table query and take your 5 out of that. A
join is the right way to go with this though I reckon.

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




Adding a DESC after ORDER BY rating did it perfectly.  I had tried a few
JOIN queries, but was building them incorrectly.  Thank you so much for your
help.

Ben



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

Hello, this function does not work for me... And I really don't know what am I 
doing wrong... Any help??

This function is in a class, and I call it in a form, to create a new user..



    $objEmploye=new Employe;
    if ( 
$objEmploye->insert(array($name,$lastname,$salary,$dui,$afp,$isss,$nit)) == 
true){
        echo 'Saved';
    }else{
        echo 'Error, try again';
    } 
}else{


    function insert($field){
        if($this->con->connect()==true){
            return mysql_query("INSERT INTO employes (name,lastname, salary, 
id, afp, isss, nit) VALUES ('".$field[0]."', 
'".$field[1]."','".$field[2]."','".$field[3]."','".$field[4]."','".$field[5]."','".$field[6]."')");
        }
    }




Thanks.
                                          
_________________________________________________________________
http://clk.atdmt.com/UKM/go/197222280/direct/01/
Do you have a story that started on Hotmail? Tell us now

--- End Message ---
--- Begin Message ---
On Fri, 2010-07-02 at 22:05 +0000, Carlos Sura wrote:

> 
> Hello, this function does not work for me... And I really don't know what am 
> I doing wrong... Any help??
> 
> This function is in a class, and I call it in a form, to create a new user..
> 
> 
> 
>     $objEmploye=new Employe;
>     if ( 
> $objEmploye->insert(array($name,$lastname,$salary,$dui,$afp,$isss,$nit)) == 
> true){
>         echo 'Saved';
>     }else{
>         echo 'Error, try again';
>     } 
> }else{
> 
> 
>     function insert($field){
>         if($this->con->connect()==true){
>             return mysql_query("INSERT INTO employes (name,lastname, salary, 
> id, afp, isss, nit) VALUES ('".$field[0]."', 
> '".$field[1]."','".$field[2]."','".$field[3]."','".$field[4]."','".$field[5]."','".$field[6]."')");
>         }
>     }
> 
> 
> 
> 
> Thanks.
>                                         
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/197222280/direct/01/
> Do you have a story that started on Hotmail? Tell us now


I can't see anything wrong with that code excerpt. Are you getting a
specific error, and if so, what is the code on and around the line
number indicated in that error?

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



--- End Message ---
--- Begin Message ---
Hello Ash,

No, I don't get an error message, the thing is, my post form, isn't working... 
I can't post those fields in database when I fill them up in the form... But, I 
really don't know why... Do you want my form code? all the entire class.php 
code??

Thank you for helping me.

Carlos Sura.






Subject: Re: [PHP] What's wrong in this function? Does not work for me.
From: [email protected]
To: [email protected]
CC: [email protected]
Date: Sat, 3 Jul 2010 00:08:05 +0100






  
  


On Fri, 2010-07-02 at 22:05 +0000, Carlos Sura wrote:


Hello, this function does not work for me... And I really don't know what am I 
doing wrong... Any help??

This function is in a class, and I call it in a form, to create a new user..



    $objEmploye=new Employe;
    if ( 
$objEmploye->insert(array($name,$lastname,$salary,$dui,$afp,$isss,$nit)) == 
true){
        echo 'Saved';
    }else{
        echo 'Error, try again';
    } 
}else{


    function insert($field){
        if($this->con->connect()==true){
            return mysql_query("INSERT INTO employes (name,lastname, salary, 
id, afp, isss, nit) VALUES ('".$field[0]."', 
'".$field[1]."','".$field[2]."','".$field[3]."','".$field[4]."','".$field[5]."','".$field[6]."')");
        }
    }




Thanks.
                                          
_________________________________________________________________
http://clk.atdmt.com/UKM/go/197222280/direct/01/
Do you have a story that started on Hotmail? Tell us now




I can't see anything wrong with that code excerpt. Are you getting a specific 
error, and if so, what is the code on and around the line number indicated in 
that error?






Thanks,

Ash

http://www.ashleysheridan.co.uk







                                          
_________________________________________________________________
http://clk.atdmt.com/UKM/go/197222280/direct/01/
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now

--- End Message ---
--- Begin Message ---
On Fri, 2010-07-02 at 23:19 +0000, Carlos Sura wrote:

> Hello Ash,
> 
> No, I don't get an error message, the thing is, my post form, isn't 
> working... I can't post those fields in database when I fill them up in the 
> form... But, I really don't know why... Do you want my form code? all the 
> entire class.php code??
> 
> Thank you for helping me.
> 
> Carlos Sura.
> 
> 
> 
> 
> 
> 
> Subject: Re: [PHP] What's wrong in this function? Does not work for me.
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Date: Sat, 3 Jul 2010 00:08:05 +0100
> 
> 
> 
> 
> 
> 
>   
>   
> 
> 
> On Fri, 2010-07-02 at 22:05 +0000, Carlos Sura wrote:
> 
> 
> Hello, this function does not work for me... And I really don't know what am 
> I doing wrong... Any help??
> 
> This function is in a class, and I call it in a form, to create a new user..
> 
> 
> 
>     $objEmploye=new Employe;
>     if ( 
> $objEmploye->insert(array($name,$lastname,$salary,$dui,$afp,$isss,$nit)) == 
> true){
>         echo 'Saved';
>     }else{
>         echo 'Error, try again';
>     } 
> }else{
> 
> 
>     function insert($field){
>         if($this->con->connect()==true){
>             return mysql_query("INSERT INTO employes (name,lastname, salary, 
> id, afp, isss, nit) VALUES ('".$field[0]."', 
> '".$field[1]."','".$field[2]."','".$field[3]."','".$field[4]."','".$field[5]."','".$field[6]."')");
>         }
>     }
> 
> 
> 
> 
> Thanks.
>                                         
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/197222280/direct/01/
> Do you have a story that started on Hotmail? Tell us now
> 
> 
> 
> 
> I can't see anything wrong with that code excerpt. Are you getting a specific 
> error, and if so, what is the code on and around the line number indicated in 
> that error?
> 
> 
> 
> 
> 
> 
> Thanks,
> 
> Ash
> 
> http://www.ashleysheridan.co.uk
> 
> 
> 
> 
> 
> 
> 
>                                         
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/197222280/direct/01/
> We want to hear all your funny, exciting and crazy Hotmail stories. Tell us 
> now


Break the code down into very simple parts with echo statements. First,
I'd echo out the $_POST or $_GET data that you're using to see if the
values you think are being sent are being sent. Then, move onto the next
part of code, stepping through with echo statements to output variable
values to ensure that your data is following the right path. This is one
of the easiest ways to find a problem I've found, short of using an IDE
to step through the code.

Also, you could put the code up on something like pastebin and post a
link to it, which will let people see what the code looks like and
hopefully figure out where the problem is.

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



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

multiple things:
- escape your values:
  1. if some of the user input contains '\'' for instance, your query is
not well formed
  2. if some evil user want to do anything with your DB, he can do it
  => See mysql_escape_string or PDO prepared statements
- Use "else" part of the if statement everywhere you can to see where
the error is. Maybe you can not connect to DB for instance...

Hope you will fix your code..

Le vendredi 02 juillet 2010 à 22:05 +0000, Carlos Sura a écrit : 
> 
> Hello, this function does not work for me... And I really don't know what am 
> I doing wrong... Any help??
> 
> This function is in a class, and I call it in a form, to create a new user..
> 
> 
> 
>     $objEmploye=new Employe;
>     if ( 
> $objEmploye->insert(array($name,$lastname,$salary,$dui,$afp,$isss,$nit)) == 
> true){
>         echo 'Saved';
>     }else{
>         echo 'Error, try again';
>     } 
> }else{
> 
> 
>     function insert($field){
>         if($this->con->connect()==true){
>             return mysql_query("INSERT INTO employes (name,lastname, salary, 
> id, afp, isss, nit) VALUES ('".$field[0]."', 
> '".$field[1]."','".$field[2]."','".$field[3]."','".$field[4]."','".$field[5]."','".$field[6]."')");
>         }
>     }
> 
> 
> 
> 
> Thanks.
>                                         
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/197222280/direct/01/
> Do you have a story that started on Hotmail? Tell us now



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

on 07/01/2010 10:09 AM Shreyas Agasthya said the following:
> PHP'ers,
> 
> I am sure this would have been asked a zillion times but I take this as my
> turn to get some help. I hate to ask such rhetorical questions but quite
> couldn't understand how to tweak this.
> 
> All I am trying to do is send a mail from my localhost to my Gmail ID. I
> read stuff about how the SMTP port should be accessible; should be open et
> al. My set-up is very simple:

You cannot use the mail() function because it does not support
authentication.

You need to use some other component that supports SMTP authentication.

I use the MIME message class along with a SMTP class.

http://www.phpclasses.org/mimemessage

You may want to read this article to learn how to set it right to send
messages via Gmail, Hotmail or Yahoo.

http://www.phpclasses.org/blog/package/9/post/1-Sending-email-using-SMTP-servers-of-Gmail-Hotmail-or-Yahoo-with-PHP.html

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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

on 07/01/2010 10:34 AM [email protected] said the following:
> Hi List,
> 
> I am working on generated emails, using the mail() function.
> Works fine, but when including characters like &#8743 (= &and;) or &#8744; (= 
> &or;)
> in the message, these characters are displayed as ? in the emails.
> 
> Snippet:
> $headers  = 'MIME-Version: 1.0' . "\r\n";
> $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
> ...
> $bool = mail ($mailto, $subject, $body, $headers);
> 
> also tested with:
> $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
> but without result.
> 
> Any ideas ?
> TIA, Cor

When those characters appear as question marks is because you are using
a font in the messages that does not have characters with those codes.

Try including the sections of those characters with some span tags like
this <span style="font-family: font-name-here">&#8744;</span>

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--- End Message ---

Reply via email to