[PHP] Re: phpDesigner 2008?

2008-11-18 Thread Holografix
Hi
I tried PHPDesigner some time ago. It's not bad but now I'm using Netbeans 
and it's a good editor: http://www.netbeans.org/ (it's free!)

Best regards,
Holo


Waynn Lue [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
I know the IDE wars spring up occasionally, but looking through the
 archives, I haven't seen any discussions pro or con for phpDesigner 2008 (
 http://www.mpsoftware.dk/phpdesigner.php).  Anyone had a chance to use it
 and think it's good or not?

 I just installed PDT + Eclipse today, and I'm still getting used to the
 integration.  I'm used to Eclipse + Java, so it somewhat throws me for a
 loop in trying to figure out what works in what scope.  I do wish I could
 have it do some kind of analysis of my files plus dependencies so any
 problems could be discovered at compile time, rather than run time.

 Thanks,
 Waynn
 



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



Re: [PHP] Traverse directory - Find empty directory

2008-02-29 Thread Holografix
Hi
Thank you for answering my question Jim.
I didn't notice the message get into the list because I get errors when 
posting and then I quit to post and try to solve the problem. Your solution 
is good and nice. I used scandir() instead of glob() with a recursive 
function.

Best regards
holo


Jim Lucas [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Holografix wrote:
 Hi

 I'm using Spl RecursiveDirectoryIterator to traverse a directory and have 
 no problem with it but now I'm stuck. I only need to display directories 
 with no files in it.

 Can someone help with this?

 My current code:

 set_time_limit(0);

 $files = new RecursiveIteratorIterator(new 
 RecursiveDirectoryIterator('c:\dev'), 
 RecursiveIteratorIterator::SELF_FIRST);
 foreach($files as $file) {
 if ($files-isDir()) {
 echo $file . br/;
 }
 }

 I have
 c:\dev
 c:\dev\php
 c:\dev\php\file1.php
 c:\dev\php\file2.php
 c:\dev\php\test
 c:\dev\php\test\db

 I would like to display 'test' because although there is a 'db'  folder, 
 there are no files in c:\dev\php\test



 Bets regards,
 holo

 This should do what you are looking to do.

 Someone else might find a better way of doing it, but this will work.

 ?php

 set_time_limit(0);

 $path = './';

 $files = new RecursiveIteratorIterator(new 
 RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
 foreach($files as $file) {
 if ($files-isDir()) {
 if ( ( $results = glob($file.'/*') ) !== false ) {
 $file_found = false;
 foreach ( $results AS $entry ) {
 if ( is_file($entry) ) {
 $file_found = true;
 break;
 }
 }

 if ( !$file_found )
 echo $file .  DOES NOT contain files\n;

 }
 }
 }


 -- 
 Jim Lucas

Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them.

 Twelfth Night, Act II, Scene V
 by William Shakespeare 

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



[PHP] Traverse directory - Find empty directory

2008-02-28 Thread Holografix
Hi

I'm using Spl RecursiveDirectoryIterator to traverse a directory and have no 
problem with it but now I'm stuck. I only need to display directories with 
no files in it.

Can someone help with this?

My current code:

set_time_limit(0);

$files = new RecursiveIteratorIterator(new 
RecursiveDirectoryIterator('c:\dev'), 
RecursiveIteratorIterator::SELF_FIRST);
foreach($files as $file) {
if ($files-isDir()) {
echo $file . br/;
}
}

I have
c:\dev
c:\dev\php
c:\dev\php\file1.php
c:\dev\php\file2.php
c:\dev\php\test
c:\dev\php\test\db

I would like to display 'test' because although there is a 'db'  folder, 
there are no files in c:\dev\php\test



Bets regards,
holo 

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



Re: [PHP] Sessions - Ini settings and timeout

2007-10-18 Thread Holografix
Many thanks again Zoltán.
It's working nice now.

Best regards
holo


Zoltán Németh [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 2007. 10. 17, szerda keltezéssel 15.10-kor Holografix ezt írta:
 Many thanks Zoltn.

 It's clear now
 One more thing: session.cookie_lifetime defaults to 0 (until browser is
 closed).
 if setting session.cookie_lifetime to 60 can I look for
 $_SESSION[session_name()] in every request ?

 why $_SESSION[session_name()]?
 I never bother with session_name and stuff like that, just put whatever
 I want to store in $_SESSION and voila it's there :)

 about session.cookie_lifetime: if the cookie expires on the client
 computer, the browser would not send it, so the server side would not
 receive the session ID, so the session data would be lost. that's good
 in some cases, but if you leave cookie_lifetime at its default, cookies
 expire when the browser is closed. that, combined with a lasttime value
 stored in the session, should be enough.

 greets
 Zoltán Németh


 best regards
 holo


 Zoltn Nmeth [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  2007. 10. 17, szerda keltezssel 11.58-kor Holografix ezt rta:
  I have some questions about sessions timeout and sessions ini 
  settings.
 
  In php.ini I have session.gc_maxlifetime = 30 (for testing purpose 
  only)
  ,
  session.gc_probability = 1 and session.gc_divisor = 100 (didn't touch
  this
  values)
 
  I have two simple pages
 
 
  page1.php
  -
  session_start();
  $_SESSION[test] = TEST;
  a href=page2.phptest timeout/a
 
 
  page2.php
  =
  session_start();
  if (!isset($_SESSION[test]) ) {
  echo no session; die();
  }
  print_r($_SESSION);
 
 
  I open page1.php in the browser and only click in the link after 
  waiting
  more than 30 seconds (session.gc_maxlifetime).
  After this period what should happen with $_SESSION[test] in 
  page2.php?
 
  In php, session.gc_maxlifetime: ; After this number of seconds, stored
  data
  will be seen as 'garbage' and
  ; cleaned up by the garbage collection process.
 
  I need to understand this and get a way to automaticly logout a user
  after n
  minutes of inactivity.
 
  session.gc_maxlifetime is not what you are looking for. it works like 
  at
  every request there is a 1/100 chance
  (session.gc_probability/session.gc_divisor) that the garbage collector
  will run. if it runs, and finds session data older than
  session.gc_maxlifetime, that is cleaned up.
 
  in order to achieve what you want you should store a 'last action'
  timestamp or something like that in the session, and upon each request
  check how many seconds passed since that timestamp and decide session
  validity based on that. eg:
 
  session_start();
  if ($_SESSION['last_action_timestamp'] - time()  $max_lifetime)
  {
  // session expired
  }
  else
  {
  $_SESSION['last_action_timestamp'] = time();
  }
 
  greets
  Zoltn Nmeth
 
 
  My environment:
  Windows XP PRO SP2, apache 2.2.4, php 5.2.4 (apache module),  mysql 
  5.4.5
 
 
  Best regards
  holo
 
 

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



Re: [PHP] Sessions - Ini settings and timeout

2007-10-18 Thread Holografix
Hi.
Thank you very much Casey. I followed this suggestion as Zoltán also 
suggested and it's working nice.

Best regards,
holo

Casey [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 You could set $_SESSION['lasttime'] to time() and check it on every  page.



 On Oct 17, 2007, at 3:58 AM, Holografix [EMAIL PROTECTED] wrote:

 I have some questions about sessions timeout and sessions ini  settings.

 In php.ini I have session.gc_maxlifetime = 30 (for testing purpose  only) 
 ,
 session.gc_probability = 1 and session.gc_divisor = 100 (didn't  touch 
 this
 values)

 I have two simple pages


 page1.php
 -
 session_start();
 $_SESSION[test] = TEST;
 a href=page2.phptest timeout/a


 page2.php
 =
 session_start();
 if (!isset($_SESSION[test]) ) {
echo no session; die();
 }
 print_r($_SESSION);


 I open page1.php in the browser and only click in the link after  waiting
 more than 30 seconds (session.gc_maxlifetime).
 After this period what should happen with $_SESSION[test] in 
 page2.php?

 In php, session.gc_maxlifetime: ; After this number of seconds,  stored 
 data
 will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.

 I need to understand this and get a way to automaticly logout a user 
 after n
 minutes of inactivity.

 My environment:
 Windows XP PRO SP2, apache 2.2.4, php 5.2.4 (apache module),  mysql 
 5.4.5


 Best regards
 holo

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

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



[PHP] Sessions - Ini settings and timeout

2007-10-17 Thread Holografix
I have some questions about sessions timeout and sessions ini settings.

In php.ini I have session.gc_maxlifetime = 30 (for testing purpose only) ,
session.gc_probability = 1 and session.gc_divisor = 100 (didn't touch this 
values)

I have two simple pages


page1.php
-
session_start();
$_SESSION[test] = TEST;
a href=page2.phptest timeout/a


page2.php
=
session_start();
if (!isset($_SESSION[test]) ) {
echo no session; die();
}
print_r($_SESSION);


I open page1.php in the browser and only click in the link after waiting 
more than 30 seconds (session.gc_maxlifetime).
After this period what should happen with $_SESSION[test] in page2.php?

In php, session.gc_maxlifetime: ; After this number of seconds, stored data 
will be seen as 'garbage' and
; cleaned up by the garbage collection process.

I need to understand this and get a way to automaticly logout a user after n 
minutes of inactivity.

My environment:
Windows XP PRO SP2, apache 2.2.4, php 5.2.4 (apache module),  mysql 5.4.5


Best regards
holo

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



Re: [PHP] Sessions - Ini settings and timeout

2007-10-17 Thread Holografix
Many thanks Zoltán.

It's clear now
One more thing: session.cookie_lifetime defaults to 0 (until browser is 
closed).
if setting session.cookie_lifetime to 60 can I look for 
$_SESSION[session_name()] in every request ?

best regards
holo


Zoltán Németh [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 2007. 10. 17, szerda keltezéssel 11.58-kor Holografix ezt írta:
 I have some questions about sessions timeout and sessions ini settings.

 In php.ini I have session.gc_maxlifetime = 30 (for testing purpose only) 
 ,
 session.gc_probability = 1 and session.gc_divisor = 100 (didn't touch 
 this
 values)

 I have two simple pages


 page1.php
 -
 session_start();
 $_SESSION[test] = TEST;
 a href=page2.phptest timeout/a


 page2.php
 =
 session_start();
 if (!isset($_SESSION[test]) ) {
 echo no session; die();
 }
 print_r($_SESSION);


 I open page1.php in the browser and only click in the link after waiting
 more than 30 seconds (session.gc_maxlifetime).
 After this period what should happen with $_SESSION[test] in page2.php?

 In php, session.gc_maxlifetime: ; After this number of seconds, stored 
 data
 will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.

 I need to understand this and get a way to automaticly logout a user 
 after n
 minutes of inactivity.

 session.gc_maxlifetime is not what you are looking for. it works like at
 every request there is a 1/100 chance
 (session.gc_probability/session.gc_divisor) that the garbage collector
 will run. if it runs, and finds session data older than
 session.gc_maxlifetime, that is cleaned up.

 in order to achieve what you want you should store a 'last action'
 timestamp or something like that in the session, and upon each request
 check how many seconds passed since that timestamp and decide session
 validity based on that. eg:

 session_start();
 if ($_SESSION['last_action_timestamp'] - time()  $max_lifetime)
 {
 // session expired
 }
 else
 {
 $_SESSION['last_action_timestamp'] = time();
 }

 greets
 Zoltán Németh


 My environment:
 Windows XP PRO SP2, apache 2.2.4, php 5.2.4 (apache module),  mysql 5.4.5


 Best regards
 holo
 

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



Re: [PHP] PHP and Java: accessing Java classes from PHP

2007-07-31 Thread Holografix
Hi


 If you mean you tried this:
 http://php.net/java

It was the first thing I tried. I will post a bug in http://bugs.php.net

Then I read about php-java-bridge but the examples were using older versions 
of php-jb.

 That said, I don't see how you could possibly access Java without
 running Java... But maybe servelets is something separate from the
 monolithic Java already running?

We can't use apache tomcat (java app server). Java is present and running 
but not tomcat.

 You might also consider taking a step back and writing a Java program
 that uses SOAP/RPC/??? to provide the info PHP needs via HTTP instead
 of trying to get PHP and Java to play nice together at the binary
 level...

I am not the java coder so I have to use the code that already exists.

Thank you very much for the answer.

greets
holo


Richard Lynch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Fri, July 27, 2007 10:31 am, Holografix wrote:
 I need to access some custom and native Java classes from php.
 I've tried the steps form php manual and php-javabridge from sf but I
 always
 get an apache crash.
 I don't need to run servlets and it's impossible to start servlet
 engine in
 the server (project requirements).

 The tutorials i've found are outdated (old php-javabridge versions)
 and
 refer to some files that no longer exists.

 If someone can point the right direction I would like to see the
 solution.

 I'm using win xp pro sp2, php 5.2.3, java 1.6.0_02.

 If you mean you tried this:
 http://php.net/java
 and it crashed, then post a bug report here:
 http://bugs.php.net/

 If you haven't tried that, try it. :-)

 That said, I don't see how you could possibly access Java without
 running Java... But maybe servelets is something separate from the
 monolithic Java already running?

 You might also consider taking a step back and writing a Java program
 that uses SOAP/RPC/??? to provide the info PHP needs via HTTP instead
 of trying to get PHP and Java to play nice together at the binary
 level...

 -- 
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?
 

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



[PHP] PHP and Java: accessing Java classes from PHP

2007-07-27 Thread Holografix
Hi

I need to access some custom and native Java classes from php.
I've tried the steps form php manual and php-javabridge from sf but I always 
get an apache crash.
I don't need to run servlets and it's impossible to start servlet engine in 
the server (project requirements).

The tutorials i've found are outdated (old php-javabridge versions) and 
refer to some files that no longer exists.

If someone can point the right direction I would like to see the solution.

I'm using win xp pro sp2, php 5.2.3, java 1.6.0_02.

Thanks in advance.

Greets
holo

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



Re: [PHP] PHP and Java: accessing Java classes from PHP

2007-07-27 Thread Holografix
Hi

Thanks for the answer.
I'm using php 5 (5.2.3).

holo

Nathan Nobbe [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 if you cant get the php / java bridge to work and you cant run servlets 
 than
 i dont know
 what other options you have.  we used to use soap for communication 
 between
 java and
 php where i worked last, but that would require servlets as well (afaik).
 the bridge is marked as experimental..
 are you using php4 or php5?  if youre using 4 the source is there in /ext
 under the php source.
 if youre using 5 well i couldt find it on the pecl site [didnt search very
 long] but you can get the
 source here http://php-java-bridge.sourceforge.net/pjb/.

 -nathan

 On 7/27/07, Holografix [EMAIL PROTECTED] wrote:

 Hi

 I need to access some custom and native Java classes from php.
 I've tried the steps form php manual and php-javabridge from sf but I
 always
 get an apache crash.
 I don't need to run servlets and it's impossible to start servlet engine
 in
 the server (project requirements).

 The tutorials i've found are outdated (old php-javabridge versions) and
 refer to some files that no longer exists.

 If someone can point the right direction I would like to see the 
 solution.

 I'm using win xp pro sp2, php 5.2.3, java 1.6.0_02.

 Thanks in advance.

 Greets
 holo

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


 

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



[PHP] pdf_open_memory_image - call to undefined function

2005-12-11 Thread Holografix
Hi
I have php_pdf.dll enabled in php.ini.
I've downloaded this extension from pecl4win.php.net - php 5.1.1 (I'm using 
php-5.1.2-dev snapshot)
The extension is loaded. phpinfo() reports it:

  PDF Support  enabled
  PDFlib GmbH Version  5.0.3
  PECL Version  2.0.5
  Revision  $Revision: 1.144 $


I have also tried libpdf_php.dll from pdflib.com but I get the same error.
This is the code:
$pdf = pdf_new();
pdf_open_file($pdf, );

$pimg = pdf_open_memory_image($pdf, $im);   == LINE 52
pdf_begin_page($pdf, 595, 842);
pdf_add_outline($pdf, Page 1);
pdf_place_image($pdf, $pimg, 0, 500, 1);
pdf_close_image($pdf, $pimg);
pdf_end_page($pdf);
pdf_close($pdf);
$buf = pdf_get_buffer($pdf);
$len = strlen($buf);
header(Content-type: application/pdf);
header(Content-Length: $len);
header(Content-Disposition: inline; filename=jpimage.pdf);
echo $buf;
pdf_delete($pdf);

$im is created with jpgraph and displays fine in the browser,

[12-Dec-2005 01:10:04] PHP Fatal error:  Call to undefined function 
pdf_open_memory_image() in C:\www\home\tests\image5g.php on line 52

What's the problem here ?

Best regards
holo

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



[PHP] Re: MySql connection error on win XP for script that works on Freebsd 5.3

2005-10-26 Thread Holografix
Hi
See this
http://dev.mysql.com/doc/refman/5.0/en/old-client.html

Best regards

Vizion [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
I have just installed MySql on Win XP and am attempting to run a php script 
to
 create some databases. The script works fine on FreeBSD 5.3 running
 mysql-client-5.0.11 and mysql-server-5.0.11.

 MySQL has been installed on windows XP using a download of
 mysql-5.0.13-rc-win32.zip. Test.php reports php version 4.3.1.0 and is
 installed with ZendStudio which I am currently testing on win XP as I 
 cannot
 yet  get any version of Zend later than 3.x to run on FreeBSD.

 The username for mysql is 10 chars with a password of 8 chars and is able 
 to
 login successfully from the command line.

 However when attempting to login via the script I get the following error:

 Error while connecting to MySQL: Client does not support authentication
 protocol requested by server; consider upgrading MySQL client.

 I have searched the mysql website and located an article which shows 
 reference
 to this error indicating that the client may need to be upgraded but as I 
 am
 using the mysql-5.0.13-rc-win32.zip package I am cautious about assuming 
 that
 that is the actual cause.

 I am curious whether it is something to do with the php version.

 Does anyone know how I can fix this?

 Please ask for additional information you think might be helpful
 Thanks in advance

 david


 -- 
 40 yrs navigating and computing in blue waters.
 English Owner  Captain of British Registered 60' bluewater Ketch S/V 
 Taurus.
 Currently in San Diego, CA. Sailing bound for Europe via Panama Canal 
 after
 completing engineroom refit. 

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



[PHP] Re: PHP 5.0.4 on AMD64

2005-08-05 Thread Holografix
Hi

Take a look here: http://forums.fedoraforum.org/showthread.php?t=59163

I had that problem too.

Regards
holografix


Joseph Oaks [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
 So, heres the deal, I'm running Fedora Core 3 on an dual proc AMD64 
 system.

 I have compiled Apache 2.0.54, and PHP 5.0.4, when I try to start apache
 I am given an error. The error is as follows...

 [EMAIL PROTECTED] conf]# /etc/rc.d/init.d/httpd start
 Starting httpd: Syntax error on line 24 of 
 /opt/apache-2.0.54/conf/httpd.conf:
 Cannot load /opt/apache-2.0.54/modules/libphp5.so into server:
 /opt/apache-2.0.54/modules/libphp5.so: cannot restore segment prot after
 reloc:
 Permission denied

 The only thing I'm finding on google is about /usr/lib64 well I don't have 
 a
 /usr/lib64, its just /usr/lib so that can't be the issue.

 Any suggestion would be appreciated.
 thanks

 Joe

 -- 
 Computers are like air conditioners - they stop working properly when you
 open Windows 

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



Re: [PHP] PDO Error

2005-07-15 Thread Holografix
Hi Marek

It's print_r($row), not print_r($stmt) ;)



Marek Kilimajer [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
 Holografix wrote:
 Hi. When using this example from 
 http://netevil.org/talks/index.php?t=pdos=20, the site of pdo's author I 
 have this error:

 Fatal error: Call to a member function fetchAll() on a non-object in 
 /www/home/testes/pdo_my1.php on line 17


 $dbh = new PDO('mysql:host=localhost;dbname=dbtest', 'user', 'pass');
 $stmt = $dbh-query(SELECT * FROM foo);

 what does print_r($stmt); print here?

 $rows = $stmt-fetchAll();
 $count = count($rows);
 foreach ($rows as $row) {
 print_r($row);
 }
 $stmt = null;

 Wht's wrong with the example?

 Greetings
 holografix
 

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



Re: [PHP] PDO Error

2005-07-15 Thread Holografix
Hi Georgi

From php manual:

PDO::query
Executes an SQL statement, returning a result set as a PDOStatement object 
()

object PDO::query ( string statement )

So, $stmt shoul be an object.

Thanks four your answers.
I will post a more detailed message in php-db where this problem belongs. My 
fault posted it in php-general.

Greetings



Georgi Ivanov [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
 Hi. When using this example from
 http://netevil.org/talks/index.php?t=pdos=20, the site of pdo's author I
 have this error:

 Fatal error: Call to a member function fetchAll() on a non-object in
 /www/home/testes/pdo_my1.php on line 17


 Object creation :
 $dbh = new PDO('mysql:host=localhost;dbname=dbtest', 'user', 'pass');
 $stmt = $dbh-query(SELECT * FROM foo);
 Here I think  $stmt is NOT an object.
 $stmp should be RESOURCE or boolean value most likely.
 So it should be $rows=$dbh-fetchAll();
 $rows = $stmt-fetchAll();
 $count = count($rows);
 foreach ($rows as $row) {
 print_r($row);
 }
 $stmt = null;

 Wht's wrong with the example?

 Greetings
 holografix

 -- 
 Regards
 Georgi Ivanov 

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



Re: [PHP] PDO Error

2005-07-15 Thread Holografix
print_r($stmt) prints nothing. print($stmt) print nothing too.

I checked errorCode() and it prints .


Marek Kilimajer [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
 Holografix wrote:
 Hi Marek

 It's print_r($row), not print_r($stmt) ;)

 That's what I'm asking - If you put print_r($stmt) in that line, what does 
 it print?




 Marek Kilimajer [EMAIL PROTECTED] escreveu na mensagem 
 news:[EMAIL PROTECTED]

Holografix wrote:

Hi. When using this example from 
http://netevil.org/talks/index.php?t=pdos=20, the site of pdo's author 
I have this error:

Fatal error: Call to a member function fetchAll() on a non-object in 
/www/home/testes/pdo_my1.php on line 17


$dbh = new PDO('mysql:host=localhost;dbname=dbtest', 'user', 'pass');
$stmt = $dbh-query(SELECT * FROM foo);

what does print_r($stmt); print here?


$rows = $stmt-fetchAll();
$count = count($rows);
foreach ($rows as $row) {
print_r($row);
}
$stmt = null;

Wht's wrong with the example?

Greetings
holografix

 

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



Re: [PHP] PDO Error

2005-07-15 Thread Holografix
Yes, you're right. It's false

This dont't work too.

foreach ($dbh-query('SELECT * FROM words') as $row) {
   echo $row['word'] . br;
}

But this works
$stmt = $dbh-prepare('select * from words');
$stmt-execute();

$rows = $stmt-fetchAll();

echo count($rows) . brbr;




Marek Kilimajer [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
 Holografix wrote:
 print_r($stmt) prints nothing. print($stmt) print nothing too.

 I checked errorCode() and it prints .

 Then it seems $stmt is false. var_dump() is more verbose about it.



 Marek Kilimajer [EMAIL PROTECTED] escreveu na mensagem 
 news:[EMAIL PROTECTED]

Holografix wrote:

Hi Marek

It's print_r($row), not print_r($stmt) ;)

That's what I'm asking - If you put print_r($stmt) in that line, what 
does it print?




Marek Kilimajer [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]


Holografix wrote:


Hi. When using this example from 
http://netevil.org/talks/index.php?t=pdos=20, the site of pdo's 
author I have this error:

Fatal error: Call to a member function fetchAll() on a non-object in 
/www/home/testes/pdo_my1.php on line 17


$dbh = new PDO('mysql:host=localhost;dbname=dbtest', 'user', 'pass');
$stmt = $dbh-query(SELECT * FROM foo);

what does print_r($stmt); print here?



$rows = $stmt-fetchAll();
$count = count($rows);
foreach ($rows as $row) {
   print_r($row);
}
$stmt = null;

Wht's wrong with the example?

Greetings
holografix


 

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



[PHP] PDO Error

2005-07-14 Thread Holografix
Hi. When using this example from 
http://netevil.org/talks/index.php?t=pdos=20, the site of pdo's author I 
have this error:

Fatal error: Call to a member function fetchAll() on a non-object in 
/www/home/testes/pdo_my1.php on line 17


$dbh = new PDO('mysql:host=localhost;dbname=dbtest', 'user', 'pass');
$stmt = $dbh-query(SELECT * FROM foo);
$rows = $stmt-fetchAll();
$count = count($rows);
foreach ($rows as $row) {
print_r($row);
}
$stmt = null;

Wht's wrong with the example?

Greetings
holografix

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