php-general Digest 12 Dec 2011 11:49:49 -0000 Issue 7607

2011-12-12 Thread php-general-digest-help

php-general Digest 12 Dec 2011 11:49:49 - Issue 7607

Topics (messages 315971 through 315980):

Virus warning
315971 by: Ashley Sheridan
315972 by: Jason Pruim
315973 by: Daniel Brown
315974 by: HallMarc Websites
315975 by: Daniel Brown
315976 by: HallMarc Websites
315977 by: Daniel Brown
315979 by: Ashley Sheridan

How to use a variable variable in an array walk?
315978 by: Nils Leideck

Syntax problem PDO and bindvalue
315980 by: Stephen

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
Did anyone else receive an odd message today about a message to the list
bouncing back because of a virus warning? From the looks of it someone
spoofed an email to the list from my address, which meant I got the
warning email, but I wondered if anyone else was having the same issue?

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


---End Message---
---BeginMessage---
Hey Ash,

I didn't get anything... I'm guessing the list did it's thing and blocked it 
unless someone else got it!


Jason Pruim
li...@pruimphotography.com



On Dec 11, 2011, at 10:03 AM, Ashley Sheridan wrote:

 Did anyone else receive an odd message today about a message to the list
 bouncing back because of a virus warning? From the looks of it someone
 spoofed an email to the list from my address, which meant I got the
 warning email, but I wondered if anyone else was having the same issue?
 
 -- 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 

---End Message---
---BeginMessage---
On Sun, Dec 11, 2011 at 10:03, Ashley Sheridan a...@ashleysheridan.co.uk 
wrote:
 Did anyone else receive an odd message today about a message to the list
 bouncing back because of a virus warning? From the looks of it someone
 spoofed an email to the list from my address, which meant I got the
 warning email, but I wondered if anyone else was having the same issue?

Ash;

If you can, forward me the full message (off-list, of course),
headers and all.  I'll take a look at it and see what's up.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/
---End Message---
---BeginMessage---
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
 Sent: Sunday, December 11, 2011 10:04 AM
 To: PHP General List
 Subject: [PHP] Virus warning
 
 Did anyone else receive an odd message today about a message to the list
 bouncing back because of a virus warning? From the looks of it someone
 spoofed an email to the list from my address, which meant I got the warning
 email, but I wondered if anyone else was having the same issue?
 
 --
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
[] 
I got it too this morning. :\


---End Message---
---BeginMessage---
On Sun, Dec 11, 2011 at 10:40, HallMarc Websites
m...@hallmarcwebsites.com wrote:

 []
 I got it too this morning. :\

Are you you guys referring to the ezmlm warning for 315869?

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/
---End Message---
---BeginMessage---
Yes

---End Message---
---BeginMessage---
On Sun, Dec 11, 2011 at 10:52, HallMarc Websites
m...@hallmarcwebsites.com wrote:
 Yes

That's normal.  That's nothing anyone did to spoof anyone else's
email address or anything, it's simply the list saying, this was a
phishing email that some moron or bot tried to send, and your filters
blocked.

 If you read through the full text of the email, you'll see that
not only is there nothing about which to be concerned, but actually to
be admired: your email filters did their job.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/
---End Message---
---BeginMessage---
On Sun, 2011-12-11 at 11:05 -0500, Daniel Brown wrote:

 On Sun, Dec 11, 2011 at 10:52, HallMarc Websites
 m...@hallmarcwebsites.com wrote:
  Yes
 
 That's normal.  That's nothing anyone did to spoof anyone else's
 email address or anything, it's simply the list saying, this was a
 phishing email that some moron or bot tried to send, and your filters
 blocked.
 
  If you read through the full text of the email, you'll see that
 not only is there nothing about which to be concerned, but actually to
 be admired: your email filters did their job.
 
 -- 
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/
 


Ah OK, I never was very good at reading those email headers!

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


---End Message---
---BeginMessage---
Dear list,

this is my first post to the PHP general list.

I have an issue with a variable variable 
(http://php.net/manual/en/language.variables.variable.php)

My use case:

I have an array called 

[PHP] Syntax problem PDO and bindvalue

2011-12-12 Thread Stephen

So I am getting this SQL error:

Error selecting photographs: SQLSTATE[42000]: Syntax error or access 
violation: 1064 You have an error in your SQL syntax; check the manual 
that corresponds to your MySQL server version for the right syntax to 
use near ''4'' at line 2


My code is:

function updatephotos($dbh, $x) {

echo $x['number'] . br /;  this echo is 4

  $sql = SELECT * FROM photographs WHERE
  photo_filename LIKE '%2%' LIMIT 0, :q;;

  $stmt = $dbh-prepare($sql);

  try {

$stmt-bindValue( ':q', $x['number'], PDO::PARAM_INT );
$stmt-execute();

  } catch (PDOException $e) {
return 'Error selecting photographs: ' . $e-getMessage();
}

while ( list( $id, $name, $alt, $caption) = $stmt-fetch(PDO::FETCH_NUM)) {
echo $name . br /;
}


  return test worked ;
}

If I hard code the SQL as:

$sql = SELECT * FROM photographs WHERE
  photo_filename LIKE '%2%' LIMIT 0, 4;

all works well.

Can anyone see what is wrong?

How can I see the prepared SQL statement before it is executed?

Thanks
Stephen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Syntax problem PDO and bindvalue

2011-12-12 Thread FeIn
I don't think you're suppose to end your queries with a semicolon. Try:

$sql = SELECT * FROM photographs WHERE
 photo_filename LIKE '%2%' LIMIT 0, :q;


On Mon, Dec 12, 2011 at 1:49 PM, Stephen stephe...@rogers.com wrote:

 So I am getting this SQL error:

 Error selecting photographs: SQLSTATE[42000]: Syntax error or access
 violation: 1064 You have an error in your SQL syntax; check the manual that
 corresponds to your MySQL server version for the right syntax to use near
 ''4'' at line 2

 My code is:

 function updatephotos($dbh, $x) {

 echo $x['number'] . br /;  this echo is 4

  $sql = SELECT * FROM photographs WHERE
  photo_filename LIKE '%2%' LIMIT 0, :q;;

  $stmt = $dbh-prepare($sql);

  try {

$stmt-bindValue( ':q', $x['number'], PDO::PARAM_INT );
$stmt-execute();

  } catch (PDOException $e) {
return 'Error selecting photographs: ' . $e-getMessage();
}

 while ( list( $id, $name, $alt, $caption) = $stmt-fetch(PDO::FETCH_NUM)) {
 echo $name . br /;
}


  return test worked ;
 }

 If I hard code the SQL as:

 $sql = SELECT * FROM photographs WHERE
  photo_filename LIKE '%2%' LIMIT 0, 4;

 all works well.

 Can anyone see what is wrong?

 How can I see the prepared SQL statement before it is executed?

 Thanks
 Stephen

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Syntax problem PDO and bindvalue

2011-12-12 Thread Fatih P.
On Mon, Dec 12, 2011 at 4:22 PM, FeIn aci...@gmail.com wrote:

 I don't think you're suppose to end your queries with a semicolon. Try:


you can end your queries with semicolon in prepared statements.

How can I see the prepared SQL statement before it is executed?
try-  var_dump ($statement);


[PHP] PHP 5.3.6 Dates

2011-12-12 Thread Floyd Resler
If this was already discussed I apologize for the duplicate question.  For some 
reason dates of -00-00 get converted to 11/30/-0001 with the date function. 
 Is this be design or a bug?

Thanks!
Floyd


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP 5.3.6 Dates

2011-12-12 Thread Ian
On 12/12/2011 16:56, Floyd Resler wrote:
 If this was already discussed I apologize for the duplicate question.  For 
 some reason dates of -00-00 get converted to 11/30/-0001 with the date 
 function.  Is this be design or a bug?
 
 Thanks!
 Floyd
 
 

Hi,

In the past I have noticed that zero used in date functions causes a
subtraction.  In this case it is probably working like this (all
speculation!)

Start with 1 Jan 

Take away 1 Month gives:

31 Nov -0001 (not valid though)

Take away 1 day

30 Nov -0001

I'm sure someone with more knowledge of the internals can explain this
better.

Regards

Ian
-- 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.3.6 Dates

2011-12-12 Thread Matijn Woudt
On Mon, Dec 12, 2011 at 5:56 PM, Floyd Resler fres...@adex-intl.com wrote:
 If this was already discussed I apologize for the duplicate question.  For 
 some reason dates of -00-00 get converted to 11/30/-0001 with the date 
 function.  Is this be design or a bug?

 Thanks!
 Floyd


It might be related to timezones. There was a thread about a month ago
which might help you [1]. If it's not, then you might want to post
your code so we can take a closer look at it.

Cheers,

Matijn

[1] http://news.php.net/php.general/315699

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] RE: php-general Digest 9 Dec 2011 20:09:28 -0000 Issue 7604

2011-12-12 Thread David Savage
I thought I posted this in the php.net web site under the ksort user notes, 
but I don't know if it would be approved to be placed in the web site.  
 
Would ksort($sortarr,SORT_STRING) on a 1 dimensional array with a key 
comprised of 
a person's name,
-, and 
 time stamp
I..E. (key:  david savage-2011-12-12 14:43:00)
actually delete duplicate keys from the array, if there were two keys the same ?
Did not see anything regarding this in the user notes of ksort page in php.net
David


From: php-general-digest-h...@lists.php.net 
[mailto:php-general-digest-h...@lists.php.net]
Sent: Fri 12/9/2011 2:09 PM
To: php-general@lists.php.net
Subject: php-general Digest 9 Dec 2011 20:09:28 - Issue 7604




php-general Digest 9 Dec 2011 20:09:28 - Issue 7604

Topics (messages 315962 through 315967):

Re: Think I found a PHP bug
315962 by: Lester Caine

Question about performance between for iteration and extension function
315963 by: Lin Yo-An
315966 by: Matijn Woudt

Re: End of session clean-up
315964 by: Andre Majorel

offline practice
315965 by: saeed ahmed

PHP, PDO and MS-SQL ?
315967 by: Andreas

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-general@lists.php.net


--




Re: [PHP] RE: php-general Digest 9 Dec 2011 20:09:28 -0000 Issue 7604

2011-12-12 Thread Daniel P. Brown
On Mon, Dec 12, 2011 at 16:06, David Savage dsav...@cytelcom.com wrote:
 I thought I posted this in the php.net web site under the ksort user notes, 
 but I don't know if it would be approved to be placed in the web site.

 Would ksort($sortarr,SORT_STRING) on a 1 dimensional array with a key 
 comprised of
 a person's name,
 -, and
  time stamp
 I..E. (key:  david savage-2011-12-12 14:43:00)
 actually delete duplicate keys from the array, if there were two keys the 
 same ?
 Did not see anything regarding this in the user notes of ksort page in 
 php.net

If it's a question posted there as a user note, I would delete it.
 I put up a big sign on the page for posting user notes months ago,
complete with an XKCD strip, but somehow still, no one seems to notice
it (or read it, at least).

-- 
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] RE: php-general Digest 9 Dec 2011 20:09:28 -0000 Issue 7604

2011-12-12 Thread David Harkness
On Mon, Dec 12, 2011 at 1:06 PM, David Savage dsav...@cytelcom.com wrote:

 Would ksort($sortarr,SORT_STRING) on a 1 dimensional array with a key
 comprised of
 a person's name,
 -, and
  time stamp
 I..E. (key:  david savage-2011-12-12 14:43:00)
 actually delete duplicate keys from the array, if there were two keys the
 same ?


Unless I'm missing something, you couldn't have two entries with the same
key in the array to begin with.

$a = array();
$a['david savage-2011-12-12 14:43:00'] = 1;
$a['david savage-2011-12-12 14:43:00'] = 2;
print_r($a);

Array
(
[david savage-2011-12-12 14:43:00] = 2
)

David