[FX.php List] Re: PHP Question

David Tinoco davet15 at hotmail.com
Mon Oct 16 07:13:50 MDT 2006


Hi Guys,
 
Thanks for the suggestions but I found out how - the printf("%01.2f",$variable) will do the trick.
 
I send it out here in case anyone else had wondered. You just have to add the dollar sign first, like so: echo '$'; printf("%01.2f",$variable);
 
Thanks,
David



> From: fx.php_list-request at mail.iviking.org> Subject: FX.php_List Digest, Vol 27, Issue 9> To: fx.php_list at mail.iviking.org> Date: Mon, 16 Oct 2006 05:37:31 -0600> > Send FX.php_List mailing list submissions to> fx.php_list at mail.iviking.org> > To subscribe or unsubscribe via the World Wide Web, visit> http://www.iviking.org/mailman/listinfo/fx.php_list> or, via email, send a message with subject or body 'help' to> fx.php_list-request at mail.iviking.org> > You can reach the person managing the list at> fx.php_list-owner at mail.iviking.org> > When replying, please edit your Subject line so it is more specific> than "Re: Contents of FX.php_List digest..."> > > Today's Topics:> >    1. Re: Text encoding problem (Erik Andreas Cayr?)>    2. Re: Text encoding problem (Bob Patin)>    3. PHP Question (David Tinoco)>    4. Re: Updating Auto-Calc Text Fields!! GARR!!! (Dale Bengston)>    5. Re: PHP Question (Dale Bengston)>    6. RE: Display a Rlated list of records (gerry.charest at agfa.com)> > > ----------------------------------------------------------------------> > Message: 1> Date: Sun, 15 Oct 2006 21:23:17 +0200> From: Erik Andreas Cayr? <erik at cayre.dk>> Subject: Re: [FX.php List] Text encoding problem> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>> Message-ID: <3C506DFC-8F47-4DA8-B645-2CFF5BC5CE1F at cayre.dk>> Content-Type: text/plain; charset="iso-8859-1"> > > Den 15/10/2006 kl. 17.05 skrev Bob Patin:> > > It's a fairly simple form; here's the code for editing the record:> >> > <?php> > include_once('FX/server_data.php');> > include_once('FX/FX.php');> >> > $title = $_POST['title'];> > $teaser = $_POST['teaser'];> > $newsitem = nl2br(stripslashes($_POST['newsitem']));> > This is the culprit.> nl2br: You are converting newlines to <br> before storing into the db  > (which is what you don't want... right?)> > Instead you may want the opposite...> Doing this conversion, when showing the contents of the db as HTML.  > (but not inside a TEXTAREA)...> > > $id = $_POST['id'];> >> > $itin=new FX($serverIP,$webCompanionPort);> > $itin->SetDBData($dbname,'news');> > $itin->SetDBPassword('<pw>','<username>');> > $itin->AddDBParam('-recid',$id);> > $itin->AddDBParam('title',$title);> > $itin->AddDBParam('teaser',$teaser);> > $itin->AddDBParam('newsitem',$newsitem);> > $itinResult=$itin->FMEdit();> > include_once('news.php');> > ?>> >> > As you can see, I tried to strip out anything that might cause  > > trouble, in the line where $newsitem is retrieved from the POST form.> >> > hope this helps> > ---> Erik Andreas Cayré> Spangsbjerg Møllevej 169> DK-6705 Esbjerg Ø> > Home Tel: +45 75150512> Mobile: +45 40161183> > »If you can't explain it simply, you don't understand it well enough.«> -- Albert Einstein> > »If you don't have time to do it right, when will you have time to do  > it over?«> -- John Wooden, basketball coach> > > -------------- next part --------------> A non-text attachment was scrubbed...> Name: smime.p7s> Type: application/pkcs7-signature> Size: 1856 bytes> Desc: not available> Url : http://www.iviking.org/pipermail/fx.php_list/attachments/20061015/7b825daf/smime-0001.bin> > ------------------------------> > Message: 2> Date: Sun, 15 Oct 2006 14:32:22 -0500> From: Bob Patin <bob at patin.com>> Subject: Re: [FX.php List] Text encoding problem> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>> Message-ID: <12576440-4B6F-4202-9BD7-034D80F66EB7 at patin.com>> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed> > Oh! I realize now that nl2br mean "new line to line break..."> > I'll give it a try; thanks,> > Bob> > > > > On Oct 15, 2006, at 2:23 PM, Erik Andreas Cayré wrote:> > >> > Den 15/10/2006 kl. 17.05 skrev Bob Patin:> >> >> It's a fairly simple form; here's the code for editing the record:> >>> >> <?php> >> include_once('FX/server_data.php');> >> include_once('FX/FX.php');> >>> >> $title = $_POST['title'];> >> $teaser = $_POST['teaser'];> >> $newsitem = nl2br(stripslashes($_POST['newsitem']));> >> > This is the culprit.> > nl2br: You are converting newlines to <br> before storing into the  > > db (which is what you don't want... right?)> >> > Instead you may want the opposite...> > Doing this conversion, when showing the contents of the db as HTML.  > > (but not inside a TEXTAREA)...> >> >> $id = $_POST['id'];> >>> >> $itin=new FX($serverIP,$webCompanionPort);> >> $itin->SetDBData($dbname,'news');> >> $itin->SetDBPassword('<pw>','<username>');> >> $itin->AddDBParam('-recid',$id);> >> $itin->AddDBParam('title',$title);> >> $itin->AddDBParam('teaser',$teaser);> >> $itin->AddDBParam('newsitem',$newsitem);> >> $itinResult=$itin->FMEdit();> >> include_once('news.php');> >> ?>> >>> >> As you can see, I tried to strip out anything that might cause  > >> trouble, in the line where $newsitem is retrieved from the POST form.> >>> >> > hope this helps> >> > ---> > Erik Andreas Cayré> > Spangsbjerg Møllevej 169> > DK-6705 Esbjerg Ø> >> > Home Tel: +45 75150512> > Mobile: +45 40161183> >> > »If you can't explain it simply, you don't understand it well enough.«> > -- Albert Einstein> >> > »If you don't have time to do it right, when will you have time to  > > do it over?«> > -- John Wooden, basketball coach> >> >> > _______________________________________________> > FX.php_List mailing list> > FX.php_List at mail.iviking.org> > http://www.iviking.org/mailman/listinfo/fx.php_list> > > > ------------------------------> > Message: 3> Date: Sun, 15 Oct 2006 22:07:53 -0400> From: "David Tinoco" <davet15 at hotmail.com>> Subject: [FX.php List] PHP Question> To: fx.php_list at mail.iviking.org> Message-ID: <BAY101-W49F3FBD35C0422C488C8AA9090 at phx.gbl>> Content-Type: text/plain; charset="iso-8859-1"> > Does anyone know a php function that will display numbers with money format, i.e. - instead of echo $number returning 15.2, making it return 15.20.>  > Please excuse me, my PHP isn't that great.>  > Thanks,> David> _________________________________________________________________> Share your special moments by uploading 500 photos per month to Windows Live Spaces > http://clk.atdmt.com/MSN/go/msnnkwsp0100000001msn/direct/01/?href=http://spaces.live.com/signup.aspx > -------------- next part --------------> An HTML attachment was scrubbed...> URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20061015/b0ad66a1/attachment-0001.html> > ------------------------------> > Message: 4> Date: Sun, 15 Oct 2006 21:10:43 -0500> From: Dale Bengston <dbengston at preservationstudio.com>> Subject: Re: [FX.php List] Updating Auto-Calc Text Fields!! GARR!!!> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>> Message-ID:> <8FA6E037-3546-4452-9BDF-B43295727AD7 at preservationstudio.com>> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed> > Hi David,> > Would it be useful to perform the same calculation in PHP and then  > feed that value to the Qty field?> > Regards,> Dale> > > On Oct 15, 2006, at 12:12 AM, Chris Hansen wrote:> > > Okay, I'm not sure if this would work, but it should be worth a  > > try...  Rather than setting the field directly, try setting a  > > global (use SetFMGlobal() if you're using FileMaker 7 or later),  > > and then call a FileMaker script to actually set the field...   > > Basically, I'm wondering if using a FileMaker script to do the work  > > would be more dependable.  Let me know if this works as advertised.> >> > Best,> >> > --Chris Hansen> >   FileMaker 7 Certified Developer> >   Creator of FX.php> >   "The best way from FileMaker to the Web."> >   www.iViking.org> >> >> > On Oct 14, 2006, at 6:58 AM, David Tinoco wrote:> >> >> Hi Guys,> >>> >> I am having a lot of trouble with the FMEdit function,  > >> specifically when trying to update an Auto-Calc Text Field.> >>> >> It edits the record and updates the field, but only sometimes  > >> performs the calculation.> >>> >> My code is pretty straightforward.> >>> >> $newitem=new FX($serverIP,$webCompanionPort);> >> $newitem->SetDBData('XXXXXXXXXX.fp7','XXXXXXX');> >> $newitem->SetDBPassword($webPW,$webUN);> >> $newitem->AddDBParam('OriginalQty',$qty);> >> $newitem->AddDBParam('Qty',$qty);> >> $newitem->AddDBParam('-recid',$checkitemData['Line_ID'][0]);> >> $newitemResult=$newitem->FMEdit();> >>> >> Qty is the auto-calc field. I have tried switching the order of  > >> originalqty and qty but it does the same. Is there some way to  > >> FORCE it to udpate the calculation?> >>> >> Thanks,> >> David> >>> >> Stay connected with the news, people, places and online services  > >> that matter to you on Live.com Try it!> >> _______________________________________________> >> FX.php_List mailing list> >> FX.php_List at mail.iviking.org> >> http://www.iviking.org/mailman/listinfo/fx.php_list> >> > _______________________________________________> > FX.php_List mailing list> > FX.php_List at mail.iviking.org> > http://www.iviking.org/mailman/listinfo/fx.php_list> > > > ------------------------------> > Message: 5> Date: Sun, 15 Oct 2006 21:14:49 -0500> From: Dale Bengston <dbengston at preservationstudio.com>> Subject: Re: [FX.php List] PHP Question> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>> Message-ID:> <15982E2D-7135-4CC8-9CC0-D5353AD5458C at preservationstudio.com>> Content-Type: text/plain; charset="us-ascii"> > Hi David,> > There is a money_format() function, but it is not well supported on  > Windows installs of PHP. I use number_format() instead. A quick  > function search at http://www.php.net will give you all the particulars.> > Regards,> Dale> > > On Oct 15, 2006, at 9:07 PM, David Tinoco wrote:> > > Does anyone know a php function that will display numbers with  > > money format, i.e. - instead of echo $number returning 15.2, making  > > it return 15.20.> >> > Please excuse me, my PHP isn't that great.> >> > Thanks,> > David> >> > Share your special moments by uploading 500 photos per month to  > > Windows Live Spaces Share it!> > _______________________________________________> > FX.php_List mailing list> > FX.php_List at mail.iviking.org> > http://www.iviking.org/mailman/listinfo/fx.php_list> > -------------- next part --------------> An HTML attachment was scrubbed...> URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20061015/c1be9efd/attachment-0001.html> > ------------------------------> > Message: 6> Date: Mon, 16 Oct 2006 07:37:04 -0400> From: gerry.charest at agfa.com> Subject: RE: [FX.php List] Display a Rlated list of records> To: andy at fmpug.com, "FX.php Discussion List"> <fx.php_list at mail.iviking.org>> Message-ID:> <OFF3E9AACE.D0DE1522-ON85257209.003F44DE-85257209.003FB2FF at agfa.com>> Content-Type: text/plain; charset="utf-8"> > Skipped content of type multipart/alternative-------------- next part --------------> A non-text attachment was scrubbed...> Name: graycol.gif> Type: image/gif> Size: 105 bytes> Desc: not available> Url : http://www.iviking.org/pipermail/fx.php_list/attachments/20061016/a943cb31/graycol.gif> -------------- next part --------------> A non-text attachment was scrubbed...> Name: ecblank.gif> Type: image/gif> Size: 45 bytes> Desc: not available> Url : http://www.iviking.org/pipermail/fx.php_list/attachments/20061016/a943cb31/ecblank.gif> -------------- next part --------------> A non-text attachment was scrubbed...> Name: pic07372.gif> Type: image/gif> Size: 1255 bytes> Desc: not available> Url : http://www.iviking.org/pipermail/fx.php_list/attachments/20061016/a943cb31/pic07372.gif> > ------------------------------> > _______________________________________________> FX.php_List> FX.php_List at mail.iviking.org> http://www.iviking.org/mailman/listinfo/fx.php_list> > End of FX.php_List Digest, Vol 27, Issue 9> ******************************************
_________________________________________________________________
Try the new Live Search today! 
http://imagine-windowslive.com/minisites/searchlaunch/?locale=en-us&FORM=WLMTAG 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20061016/c6630d13/attachment-0001.html


More information about the FX.php_List mailing list