php-general Digest 10 Aug 2011 18:34:59 -0000 Issue 7438

2011-08-10 Thread php-general-digest-help
php-general Digest 10 Aug 2011 18:34:59 - Issue 7438 Topics (messages 314459 through 314463): Re: Using function prototypes in code 314459 by: Stuart Dallas 314460 by: Tim Streater 314461 by: David Harkness 314462 by: Simon J Welsh text insertion

Re: [PHP] Using function prototypes in code

2011-08-10 Thread Tim Streater
On 10 Aug 2011 at 02:10, Frank Thynne frank.thy...@gmail.com wrote: In the interest of clarity and maintainability I would like to be able to write code that makes it clear what kind of arguments a function expects and what it returns. So add the appropriate comments to your functions.

Re: [PHP] Using function prototypes in code

2011-08-10 Thread David Harkness
On Tue, Aug 9, 2011 at 6:10 PM, Frank Thynne frank.thy...@gmail.com wrote: function integer int_func(string $s) { // does something like, say, converting five to 5 } As Stuart pointed out, type-hinting currently only works for classes and arrays. Scalar type-hinting is planned for the

Re: [PHP] Using function prototypes in code

2011-08-10 Thread Simon J Welsh
On 10/08/2011, at 1:10 PM, Frank Thynne wrote: To confuse me a bit further, I can't find a definitive list of the basic type names. For example, is it integer or int? Both. http://php.net/manual/en/language.types.type-juggling.php#language.types.typecasting --- Simon Welsh Admin of

[PHP] text insertion

2011-08-10 Thread Chris Stinemetz
How do I preserve text formatting when text is inserted into a database table? For example: I am using a textarea to allow users to leave comments into the database and I am using: ' . mysql_real_escape_string($_POST['store_comments']) . ', to prevent SQL injection; But when I call the data

Re: [PHP] text insertion

2011-08-10 Thread Ashley Sheridan
Chris Stinemetz chrisstinem...@gmail.com wrote: How do I preserve text formatting when text is inserted into a database table? For example: I am using a textarea to allow users to leave comments into the database and I am using: ' . mysql_real_escape_string($_POST['store_comments']) . ', to

Re: [PHP] text insertion

2011-08-10 Thread Chris Stinemetz
Are you sure its not preserved? When you output text in a browser, by default its output as html, not plain text. Html ignores extraneous whitespace, and doesn't use a monospaced font, so formatting text into columns in a textarea won't work either. Look at the html source code to see what

Re: [PHP] text insertion

2011-08-10 Thread Shaun Farrell
You could try using markdown too. Sent from my iPhone On Aug 10, 2011, at 3:57 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: Chris Stinemetz chrisstinem...@gmail.com wrote: How do I preserve text formatting when text is inserted into a database table? For example: I am using

Re: [PHP] text insertion

2011-08-10 Thread Daniel P. Brown
:On Wed, Aug 10, 2011 at 16:02, Chris Stinemetz chrisstinem...@gmail.com wrote: Are you sure its not preserved? When you output text in a browser, by default its output as html, not plain text. Html ignores extraneous whitespace, and doesn't use a monospaced font, so formatting text into

RE: [PHP] regex or 'tidy' script to fix broken ? tags and introspection of variables

2011-08-10 Thread Daevid Vincent
-Original Message- From: Camilo Sperberg [mailto:unrea...@gmail.com] Sent: Tuesday, August 09, 2011 5:27 PM For the first one, it may be that zend studio does have an internal script to do the job. Check the general preferences tab, template stuff. Nope. Nothing there. Those

Re: [PHP] text insertion

2011-08-10 Thread Chris Stinemetz
   Use HTML 'pre' tags:        pre?php echo $your_content; ?/pre I just tried that and that puts all the text on a single line. echo 'tr class=topic-post td class=user-poststrong' . $posts_row['first_name'] . ' ' . $posts_row['last_name'] . ' ' . date('m-d-Y h:iA',

Re: [PHP] text insertion

2011-08-10 Thread hdedeyan
how about echo nl2br($your_content); - Original Message - From: Chris Stinemetz chrisstinem...@gmail.com Date: Wednesday, August 10, 2011 5:09 pm Subject: Re: [PHP] text insertion To: Daniel P. Brown daniel.br...@parasane.net Cc: Ashley Sheridan a...@ashleysheridan.co.uk, PHP General

Re: [PHP] text insertion

2011-08-10 Thread Chris Stinemetz
No luck. Thanks. On Aug 10, 2011 4:17 PM, hdede...@videotron.ca wrote: how about echo nl2br($your_content); - Original Message - From: Chris Stinemetz chrisstinem...@gmail.com Date: Wednesday, August 10, 2011 5:09 pm Subject: Re: [PHP] text insertion To: Daniel P. Brown

Re: [PHP] text insertion

2011-08-10 Thread Daniel P. Brown
On Wed, Aug 10, 2011 at 17:37, Chris Stinemetz chrisstinem...@gmail.com wrote: No luck. Thanks. Per list rules, please don't top-post. If the situation you're describing is accurate and correct, then pre is indeed what you want. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud

Re: Re: [PHP] text insertion

2011-08-10 Thread Tim Streater
On 10 Aug 2011 at 22:39, Daniel P. Brown daniel.br...@parasane.net wrote: On Wed, Aug 10, 2011 at 17:37, Chris Stinemetz chrisstinem...@gmail.com wrote: No luck. Thanks. Per list rules, please don't top-post. If the situation you're describing is accurate and correct, then pre is

Re: Re: [PHP] text insertion

2011-08-10 Thread Ashley Sheridan
Tim Streater t...@clothears.org.uk wrote: On 10 Aug 2011 at 22:39, Daniel P. Brown daniel.br...@parasane.net wrote: On Wed, Aug 10, 2011 at 17:37, Chris Stinemetz chrisstinem...@gmail.com wrote: No luck. Thanks. Per list rules, please don't top-post. If the situation you're

Re: Re: [PHP] text insertion

2011-08-10 Thread Tim Streater
On 10 Aug 2011 at 22:07, Chris Stinemetz chrisstinem...@gmail.com wrote:    Use HTML 'pre' tags:        pre?php echo $your_content; ?/pre I just tried that and that puts all the text on a single line. You could write the string into another textarea, which you could make readonly for

Re: [PHP] regex or 'tidy' script to fix broken ? tags and introspection of variables

2011-08-10 Thread Camilo Sperberg
On 10-08-2011, at 16:54, Daevid Vincent wrote: -Original Message- From: Camilo Sperberg [mailto:unrea...@gmail.com] Sent: Tuesday, August 09, 2011 5:27 PM For the first one, it may be that zend studio does have an internal script to do the job. Check the general preferences tab,

[PHP] Problem with inserting numbers...

2011-08-10 Thread Jason Pruim
So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am working with: ?PHP function

Re: [PHP] Problem with inserting numbers...

2011-08-10 Thread Jason Pruim
On Aug 10, 2011, at 9:36 PM, MUAD SHIBANI wrote: Basically you can increase time limit for this file to handle your request by using set_time_limit function ... Hi Maud, Looked into set_time_limit and even tried running it with a value of 120 but it didn't help... I'm affraid I have a

Re: [PHP] Problem with inserting numbers...

2011-08-10 Thread Chris Stinemetz
basically all I'm trying to do is generate the last 4 digits starting at and going up to . for testing purposes I'm just echoing back but will eventually insert the complete number back into the database as a 7 digit string. The error I'm getting is: Fatal error: Maximum

Re: [PHP] Problem with inserting numbers...

2011-08-10 Thread 李白|字一日
when $num++; executed $num will never be '1'; you may change the while loop to while ($num 1) { while ($row = ... 2011/8/11 Jason Pruim pru...@gmail.com On Aug 10, 2011, at 9:36 PM, MUAD SHIBANI wrote: Basically you can increase time limit for this file to handle your

Re: [PHP] Problem with inserting numbers...

2011-08-10 Thread Ken Robinson
At 09:22 PM 8/10/2011, Jason Pruim wrote: So here I am attempting to generate some numbers to be inserted into a database... eventually they will make up a phone number (Which I've emailed about before and know about the bad ideas with it.. But it's the customer :)) Here is the code I am

[PHP] concatenating

2011-08-10 Thread Chris Stinemetz
Is it possible to concatenate a string and an element from a mysql_fetch_assoc array? I haven't had much luck searching google. Such as concatenating results with ' . $posts_row['store_tptest'] . ' so that if there are no elements returned nothing will be displayed? Thank you, Chris -- PHP

Re: [PHP] concatenating

2011-08-10 Thread Negin Nickparsa
read the manual http://www.php.net/manual/en/ref.strings.php A comprehensive concatenation function, that works with array and strings ?php function str_cat() { $args = func_get_args() ; // Asserts that every array given as argument is $dim-size. // Keys in arrays are stripped off. // If

Re: [PHP] concatenating

2011-08-10 Thread Ken Robinson
At 12:03 AM 8/11/2011, Chris Stinemetz wrote: Is it possible to concatenate a string and an element from a mysql_fetch_assoc array? I haven't had much luck searching google. Such as concatenating results with ' . $posts_row['store_tptest'] . ' so that if there are no elements returned nothing