[PHP] PHP mysqli help

2011-08-10 Thread Peet Grobler
So I have: $result = $dbh->query ("select * from roles order by name"); $row = mysqli_fetch_object ($result); function process_field ($which) { // This fails, I need to know how to do this the right way if ($row->may_$which == 'Y') { // Print stuff } else {

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

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 $arg) { if(is_array($arg)) { if(!isset($dim)) $dim = count($arg) ; elseif($dim != count($arg)) return FALSE ; $args[$key] =

[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 G

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 work

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 > 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 usi

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: Maxim

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

[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: $value) { //echo $key . "-"

Re: [PHP] regex or 'tidy' script to fix broken

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 prefere

Re: Re: [PHP] text insertion

2011-08-10 Thread Tim Streater
On 10 Aug 2011 at 22:07, Chris Stinemetz wrote: >> >>    Use HTML 'pre' tags: >> >>         >> > > 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 this purpose. -- Cheers -- Tim -- PHP Gener

Re: Re: [PHP] text insertion

2011-08-10 Thread Ashley Sheridan
Tim Streater wrote: >On 10 Aug 2011 at 22:39, Daniel P. Brown >wrote: > >> On Wed, Aug 10, 2011 at 17:37, Chris Stinemetz > >> wrote: >>> No luck. Thanks. >> >>Per list rules, please don't top-post. >> >>If the situation you're describing is accurate and correct, then >> is indeed wha

Re: Re: [PHP] text insertion

2011-08-10 Thread Tim Streater
On 10 Aug 2011 at 22:39, Daniel P. Brown wrote: > On Wed, Aug 10, 2011 at 17:37, Chris Stinemetz > wrote: >> No luck. Thanks. > >Per list rules, please don't top-post. > >If the situation you're describing is accurate and correct, then > is indeed what you want. But can you put a ins

Re: [PHP] text insertion

2011-08-10 Thread Daniel P. Brown
On Wed, Aug 10, 2011 at 17:37, Chris Stinemetz wrote: > No luck. Thanks. Per list rules, please don't top-post. If the situation you're describing is accurate and correct, then is indeed what you want. -- Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-43

Re: [PHP] text insertion

2011-08-10 Thread Chris Stinemetz
No luck. Thanks. On Aug 10, 2011 4:17 PM, wrote: > > how about > > echo nl2br($your_content); > > > > > - Original Message - > From: Chris Stinemetz > Date: Wednesday, August 10, 2011 5:09 pm > Subject: Re: [PHP] text insertion > To: "Daniel P. Brown" > Cc: Ashley Sheridan , PHP General

Re: [PHP] text insertion

2011-08-10 Thread hdedeyan
how about echo nl2br($your_content); - Original Message - From: Chris Stinemetz Date: Wednesday, August 10, 2011 5:09 pm Subject: Re: [PHP] text insertion To: "Daniel P. Brown" Cc: Ashley Sheridan , PHP General > > > >Use HTML 'pre' tags: > > > > > > > > I just tried

Re: [PHP] text insertion

2011-08-10 Thread Chris Stinemetz
> >    Use HTML 'pre' tags: > >         > I just tried that and that puts all the text on a single line. echo ' ' . $posts_row['first_name'] . ' ' . $posts_row['last_name'] . ' ' . date('m-d-Y h:iA', strtotime($posts_row['store_date'])) . ' Broad Band test results: ' . $posts_row['store_tptest

RE: [PHP] regex or 'tidy' script to fix broken

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 Daniel P. Brown
:On Wed, Aug 10, 2011 at 16:02, Chris Stinemetz 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 >> columns in a textar

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 wrote: > > > Chris Stinemetz 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 co

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 wh

Re: [PHP] text insertion

2011-08-10 Thread Ashley Sheridan
Chris Stinemetz 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 >prevent SQL inj

[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] 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 http:

Re: [PHP] Using function prototypes in code

2011-08-10 Thread David Harkness
On Tue, Aug 9, 2011 at 6:10 PM, Frank Thynne 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 future, but for now yo

Re: [PHP] Using function prototypes in code

2011-08-10 Thread Tim Streater
On 10 Aug 2011 at 02:10, Frank Thynne 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. > This is what I tried: