php-general Digest 12 Aug 2008 18:48:06 -0000 Issue 5620

2008-08-12 Thread php-general-digest-help
php-general Digest 12 Aug 2008 18:48:06 - Issue 5620 Topics (messages 277992 through 277992): strip_tags 277992 by: Philip Thompson Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To

[PHP] strip_tags

2008-08-12 Thread Philip Thompson
Hi all. If you are sanitizing _POST input for a database by escaping (via mysql_*), is there a reason to use strip_tags()? If so, why and could you provide an example? Thanks, ~Philip innerHTML is a string. The DOM is not a string, it's a hierarchal object structure. Shoving a string

Re: [PHP] strip_tags

2008-08-12 Thread Richard Heyes
If you are sanitizing _POST input for a database by escaping (via mysql_*), is there a reason to use strip_tags()? If so, why and could you provide an example? Not really, as long as you're using something like mysql_real_escape_string(). Though if you're redisplaying it to your users (ie

Re: [PHP] strip_tags

2008-08-12 Thread Philip Thompson
On Aug 12, 2008, at 2:01 PM, Richard Heyes wrote: If you are sanitizing _POST input for a database by escaping (via mysql_*), is there a reason to use strip_tags()? If so, why and could you provide an example? Not really, as long as you're using something like mysql_real_escape_string().

Re: [PHP] strip_tags

2008-08-12 Thread Andrew Ballard
On Tue, Aug 12, 2008 at 2:47 PM, Philip Thompson [EMAIL PROTECTED] wrote: Hi all. If you are sanitizing _POST input for a database by escaping (via mysql_*), is there a reason to use strip_tags()? If so, why and could you provide an example? Thanks, ~Philip The database won't care

Re: [PHP] strip_tags

2008-08-12 Thread Richard Heyes
Actually, yes, the data is likely to be redisplayed to the users on a website. I covered that in my answer. Likely maybe; a certainty no. However, when shoving the data to the browser, I use htmlentities(). Is it recommended to use strip_tags() before sending to htmlentities()? Not unless

[PHP] More math fun

2008-08-12 Thread Jay Blanchard
abs($balanceTest) = 15.22 abs($oldLineArray[16]) = 15.22 $diff = abs($balanceTest) - abs($oldLineArray[16]); echo abs($diff) . \n; 1.7763568394E-15 WTF? This should be a big fat 0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] More math fun

2008-08-12 Thread Robert Cummings
On Tue, 2008-08-12 at 15:18 -0500, Jay Blanchard wrote: abs($balanceTest) = 15.22 abs($oldLineArray[16]) = 15.22 $diff = abs($balanceTest) - abs($oldLineArray[16]); echo abs($diff) . \n; 1.7763568394E-15 WTF? This should be a big fat 0 Please provide the list with the following

RE: [PHP] More math fun

2008-08-12 Thread Jay Blanchard
[snip] Please provide the list with the following output: ?php var_dump( $balanceTest ); var_dump( $oldLineArray[16] ); ? Methinks you have different data types. [/snip] string(5) 15.22 float(15.22) You're right*smacks forehead*. Sometimes this whole forest and trees thing kills me. --

RE: [PHP] More math fun

2008-08-12 Thread Jay Blanchard
[snip] ?php var_dump( $balanceTest ); var_dump( $oldLineArray[16] ); ? Methinks you have different data types. [/snip] string(5) 15.22 float(15.22) You're right*smacks forehead*. Sometimes this whole forest and trees thing kills me. [/snip] settype($balanceTest, float) had no effect --

RE: [PHP] More math fun

2008-08-12 Thread Jay Blanchard
[snip] string(5) 15.22 float(15.22) You're right*smacks forehead*. Sometimes this whole forest and trees thing kills me. [/snip] settype($balanceTest, float) had no effect [/snip] $diff = round(abs($balanceTest), 2) - round(abs($oldLineArray[16]), 2); Works? Does round convert the string

[PHP] Incrementing variables based on database data

2008-08-12 Thread Vinny Gullotta
below is the output I'm seeing along with my code. There are 11425 items in the database, many of each of these possible values for $i[4], however you'll see from my Output that the $iiscount variable is the only one being incremented and it is getting incremented for every row in the table.

[PHP] Re: Incrementing variables based on database data

2008-08-12 Thread Vinny Gullotta
Nevermind, I figured it out. I needed to make the if statements use == instead of = like this: if ($i[4] == IISRESET) { $iiscount = $iiscount + 1; } etc. =) Vinny Gullotta [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] below is the output I'm seeing along with my code. There are

Re: [PHP] Re: Incrementing variables based on database data

2008-08-12 Thread Micah Gersten
Why not let the DB do this for you? You can group by whatever column that is and select count(*), column_your_looking_for. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Vinny Gullotta wrote: Nevermind, I figured it out. I needed to make the if statements

Re: [PHP] strip_tags

2008-08-12 Thread Philip Thompson
On Aug 12, 2008, at 2:10 PM, Andrew Ballard wrote: On Tue, Aug 12, 2008 at 2:47 PM, Philip Thompson [EMAIL PROTECTED] wrote: Hi all. If you are sanitizing _POST input for a database by escaping (via mysql_*), is there a reason to use strip_tags()? If so, why and could you provide an

Re: [PHP] Re: Incrementing variables based on database data

2008-08-12 Thread Vinny Gullotta
Well, what I need to be able to do is then take the numbers of each count and figure out which is used the most. We use this database to log actions taken on servers in our network. What my boss wants me to come up with is a list of which commands are issued the most, which servers get the most

Re: [PHP] strip_tags

2008-08-12 Thread Andrew Ballard
On Tue, Aug 12, 2008 at 4:53 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Aug 12, 2008, at 2:10 PM, Andrew Ballard wrote: On Tue, Aug 12, 2008 at 2:47 PM, Philip Thompson [EMAIL PROTECTED] wrote: Hi all. If you are sanitizing _POST input for a database by escaping (via mysql_*), is

Re: [PHP] Re: Incrementing variables based on database data

2008-08-12 Thread Micah Gersten
Well, MySQL can aggregate the data for you so you don't have to pass it to PHP. It can just give you the results. I suggest reading up on the SELECT COUNT syntax and the GROUP BY syntax in MySQL. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Vinny

[PHP] If Column Exists

2008-08-12 Thread VamVan
Hello, I am working on data migration for one mysql db to another using PHP. How do I check if a particular table has a particular column. If not alter... Thanks

Re: [PHP] strip_tags

2008-08-12 Thread Philip Thompson
On Aug 12, 2008, at 4:11 PM, Andrew Ballard wrote: On Tue, Aug 12, 2008 at 4:53 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Aug 12, 2008, at 2:10 PM, Andrew Ballard wrote: On Tue, Aug 12, 2008 at 2:47 PM, Philip Thompson [EMAIL PROTECTED] wrote: Hi all. If you are sanitizing _POST

RE: [PHP] If Column Exists

2008-08-12 Thread Jay Blanchard
[snip] I am working on data migration for one mysql db to another using PHP. How do I check if a particular table has a particular column. If not alter... [/snip] Use DESCRIBE TABLE; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] More math fun

2008-08-12 Thread Jim Lucas
Jay Blanchard wrote: abs($balanceTest) = 15.22 abs($oldLineArray[16]) = 15.22 $diff = abs($balanceTest) - abs($oldLineArray[16]); echo abs($diff) . \n; 1.7763568394E-15 WTF? This should be a big fat 0 I do not see how it makes any difference if $balanceTest and $oldLineArray[16] are

[PHP] Re: Incrementing variables based on database data

2008-08-12 Thread Jon Drukman
Vinny Gullotta wrote: Well, what I need to be able to do is then take the numbers of each count and figure out which is used the most. We use this database to log actions taken on servers in our network. What my boss wants me to come up with is a list of which commands are issued the most,

[PHP] A dumb question regarding sending email

2008-08-12 Thread tedd
Hi gang: I wish I had another identify for asking dumb questions, but it's late and I'm tried -- so here goes. I have a herdoc that I send out as an email -- no problems there. However, how do I include a link within it? If I use http://example.com, it's just a string but not an actual

[PHP] Re: A dumb question regarding sending email

2008-08-12 Thread Ross McKay
On Tue, 12 Aug 2008 22:07:41 -0400, tedd sperling wrote: I have a herdoc that I send out as an email -- no problems there. However, how do I include a link within it? If I use http://example.com, it's just a string but not an actual link. So, how do you format a link in a heredoc? a) most

Re: [PHP] A dumb question regarding sending email

2008-08-12 Thread Chris
tedd wrote: Hi gang: I wish I had another identify for asking dumb questions, but it's late and I'm tried -- so here goes. I have a herdoc that I send out as an email -- no problems there. However, how do I include a link within it? If I use http://example.com, it's just a string but not

Re: [PHP] More math fun

2008-08-12 Thread Robert Cummings
On Tue, 2008-08-12 at 14:59 -0700, Jim Lucas wrote: Jay Blanchard wrote: abs($balanceTest) = 15.22 abs($oldLineArray[16]) = 15.22 $diff = abs($balanceTest) - abs($oldLineArray[16]); echo abs($diff) . \n; 1.7763568394E-15 WTF? This should be a big fat 0 I do not see how

Re: [PHP] More math fun

2008-08-12 Thread Micah Gersten
Robert, when you do yours, it's performing the same function on two different variable types and has to do a conversion before the function works. He was doing a numeric function on a string which might be giving the funky results. Thank you, Micah Gersten onShore Networks Internal Developer

Re: [PHP] More math fun

2008-08-12 Thread Robert Cummings
On Tue, 2008-08-12 at 23:23 -0500, Micah Gersten wrote: Robert, when you do yours, it's performing the same function on two different variable types and has to do a conversion before the function works. He was doing a numeric function on a string which might be giving the funky results.