php-general Digest 27 Jun 2006 13:16:13 -0000 Issue 4208

Topics (messages 238674 through 238697):

Question regarding OS
        238674 by: Mayank Maheshwary
        238675 by: Ligaya Turmelle
        238676 by: tedd
        238679 by: Jochem Maas

Re: uploading...
        238677 by: Chris

Fatal error: Call to a member function fetchRow() on a non-object in 
C:\Xampp\xampp\htdocs...
        238678 by: j.kuehne.sign-tronic.ch
        238680 by: Jochem Maas
        238681 by: Chris
        238684 by: j.kuehne.sign-tronic.ch
        238685 by: Chris
        238686 by: j.kuehne.sign-tronic.ch
        238687 by: Jochem Maas

àÃÒ¢Ò¶١ Licensed Windows XP Pro, win 98, 98 se, Office XP Small, Office
        238682 by: paisarn

working on a template system...
        238683 by: sempsteen

Controlling a scanner with PHP
        238688 by: George Pitcher
        238689 by: Peter Lauri
        238690 by: Jay Blanchard
        238691 by: Peter Lauri
        238693 by: Stut
        238695 by: Chris

FTP Problems
        238692 by: James Nunnerley
        238694 by: nicolas figaro
        238696 by: James Nunnerley
        238697 by: Chris

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

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


----------------------------------------------------------------------
--- Begin Message ---
Hi,

Is there a function that can detect the OS on which the script is running?

Thank you.

M.

--- End Message ---
--- Begin Message ---
Mayank Maheshwary wrote:
Hi,

Is there a function that can detect the OS on which the script is running?

Thank you.

M.

The OS of the server maybe $_SERVER['SERVER_SOFTWARE'] - *shrug*
The OS of the client is not available - server side - remember.

--

life is a game... so have fun.

--- End Message ---
--- Begin Message ---
At 11:46 AM +1000 6/27/06, Ligaya Turmelle wrote:
>Mayank Maheshwary wrote:
>>Hi,
>>
>>Is there a function that can detect the OS on which the script is running?
>>
>>Thank you.
>>
>>M.
>>
>The OS of the server maybe $_SERVER['SERVER_SOFTWARE'] - *shrug*
>The OS of the client is not available - server side - remember.


???

If you mean, the server where your php script is running, then 
$_SERVER['SERVER_SOFTWARE'].

If you mean, what the OS and browser of the client who is viewing the product 
of your script, then try $_SERVER('HTTP_USER_AGENT').

If I remember correctly, these are not "guaranteed" across all servers -- but 
are typical.

tedd
-- 
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Mayank Maheshwary wrote:
> Hi,
> 
> Is there a function that can detect the OS on which the script is running?

yes.

php_uname()

read about it here http://php.net/manual/en/function.php-uname.php
and then read 10 pages either side just for fun :-)

> 
> Thank you.
> 
> M.
> 

--- End Message ---
--- Begin Message ---
BBC wrote:
OK John....
I'm sorry if my question was not specific
- The out put error was:
    "Fatal error: call to a member function an o non object in /url/data.php
on line 34"
- And the lines are:
34.   $db->query("INSERT INTO `products`

$db isn't an object. Does it connect to the database without any problems?

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Hello 

I am pleased if someone could explain me the behaviour since is wrong the 
following function call: ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, 
$_SESSION["searchFormVars"]["offset"]+$rowCounter));
as you will find them on the bottom of the email. By the way, fetchRow() is a 
method from class DB(.php). However mysql_fetch_row() should have same 
functionality but the argument resp. the identity is different. I hardly try to 
do not mix up functionality from mysql- with db- members. 


$search = ($_SESSION["searchFormVars"]["search_eb"]);
$link = mysql_connect("localhost", "root", "040573");
 
mysql_select_db("knowledge", $link);

$query = setupQuery($_SESSION["searchFormVars"]["search"]);     

[EMAIL PROTECTED]($query);

        
     
 
   for ( $rowCounter = 0;
            ($rowCounter < SEARCH_ROWS) &&
            (( $rowCounter + $_SESSION["searchFormVars"]["offset"]) <  
mysql_num_rows($result))  && 
               ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, 
$_SESSION["searchFormVars"]["offset"]+$rowCounter));
           $rowCounter++)
      {   


Error message:
Fatal error: Call to a member function fetchRow() on a non-object in 
C:\Xampp\xampp\htdocs\www2\knowledge_db\searchnew.php on line


best regards, Georg

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
> Hello 
> 
> I am pleased if someone could explain me the behaviour since is wrong the 
> following function call: ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, 
> $_SESSION["searchFormVars"]["offset"]+$rowCounter));

I'll explain your behaviour: you repeatedly ask the same question over and over 
whilst
ignoring any/all previous replies to your question. here is another attempt:

$result IS NOT A F***ING OBJECT, IT WILL NEVER BE AN OBJECT IN THE
CODE YOU HAVE. ITS NOT AN OBJECT SO IT DOESN'T HAVE METHODS.

$result IS THE RETURN VALUE OF mysql_query().

> as you will find them on the bottom of the email. By the way, fetchRow() is a 
> method from class DB(.php). However mysql_fetch_row() should have same 
> functionality but the argument resp. the identity is different. I hardly try 
> to do not mix up functionality from mysql- with db- members. 
> 
> 
> $search = ($_SESSION["searchFormVars"]["search_eb"]);
> $link = mysql_connect("localhost", "root", "040573");
>  
> mysql_select_db("knowledge", $link);
> 
> $query = setupQuery($_SESSION["searchFormVars"]["search"]);     
> 
> [EMAIL PROTECTED]($query);

DON'T STICK @ SIGNS IN TO REPRESS ERRORS UNLESS IT'S A LAST RESORT
(AND ONLY THEN WHEN YOU KNOW WHAT YOUR DOING).

> 
>         
>      
>  
>    for ( $rowCounter = 0;
>             ($rowCounter < SEARCH_ROWS) &&
>             (( $rowCounter + $_SESSION["searchFormVars"]["offset"]) <  
> mysql_num_rows($result))  && 
>                ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, 
> $_SESSION["searchFormVars"]["offset"]+$rowCounter));

($row = mysql_fetch_assoc($result))

http://php.net/mysql_fetch_assoc

>            $rowCounter++)
>       {   
> 
> 
> Error message:
> Fatal error: Call to a member function fetchRow() on a non-object in 
> C:\Xampp\xampp\htdocs\www2\knowledge_db\searchnew.php on line
> 

DOES IT HELP IF I PUT IT IN CAPITALS?

> 
> best regards, Georg
> 

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Hello
I am pleased if someone could explain me the behaviour since is wrong the following function call: ($row = 
& $result->fetchRow(DB_FETCHMODE_ASSOC, 
$_SESSION["searchFormVars"]["offset"]+$rowCounter));
as you will find them on the bottom of the email. By the way, fetchRow() is a method from class DB(.php). However mysql_fetch_row() should have same functionality but the argument resp. the identity is different. I hardly try to do not mix up functionality from mysql- with db- members.

$search = ($_SESSION["searchFormVars"]["search_eb"]);
$link = mysql_connect("localhost", "root", "040573");
mysql_select_db("knowledge", $link);

$query = setupQuery($_SESSION["searchFormVars"]["search"]);
[EMAIL PROTECTED]($query);


Error message:
Fatal error: Call to a member function fetchRow() on a non-object in 
C:\Xampp\xampp\htdocs\www2\knowledge_db\searchnew.php on line

$result is not an object.

mysql_query does not return an object, it returns a resource handler. Maybe you want mysqli_query ?

Read the manual for both of these - there have been 3-4 replies telling you what the problem is.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Hello 

I am pleased if someone could explain me the behaviour since is wrong the 
following function call: ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, 
$_SESSION["searchFormVars"]["offset"]+$rowCounter));
as you will find them on the bottom of the email. By the way, fetchRow() is a 
method from class DB(.php). However mysql_fetch_row() should have same 
functionality but the argument resp. the identity is different. I hardly try to 
do not mix up functionality from mysql- with db- members. 

 
mysql_select_db("knowledge", $link);

$query = setupQuery($_SESSION["searchFormVars"]["search"]);     


        
     
 
   for ( $rowCounter = 0;
            ($rowCounter < SEARCH_ROWS) &&
            (( $rowCounter + $_SESSION["searchFormVars"]["offset"]) <  
mysql_num_rows($result))  && 
               ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, 
$_SESSION["searchFormVars"]["offset"]+$rowCounter));
           $rowCounter++)
      {   


Error message:
Fatal error: Call to a member function fetchRow() on a non-object in 
C:\Xampp\xampp\htdocs\www2\knowledge_db\searchnew.php on line


best regards, Georg

--- End Message ---
--- Begin Message ---

Hmm. I wonder if his mail server is stuffed.

Can we get this guy removed from the list? This is getting annoying :/

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Hello 

I am pleased if someone could explain me the behaviour since is wrong the 
following function call: ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, 
$_SESSION["searchFormVars"]["offset"]+$rowCounter));
as you will find them below. By the way, fetchRow() is a method from class 
DB(.php). However mysql_fetch_row() should have same functionality but the 
argument resp. the identity is different. I hardly try to do not mix up 
functionality from mysql- with db- members. 

 
mysql_select_db("knowledge", $link);

$query = setupQuery($_SESSION["searchFormVars"]["search"]);     

$result=mysql_query($query);
        
     
 
   for ( $rowCounter = 0;
            ($rowCounter < SEARCH_ROWS) &&
            (( $rowCounter + $_SESSION["searchFormVars"]["offset"]) <  
mysql_num_rows($result))  && 
               ($row = $result->fetchRow(DB_FETCHMODE_ASSOC, 
$_SESSION["searchFormVars"]["offset"]+$rowCounter));
           $rowCounter++)
      {   


Error message:
Fatal error: Call to a member function fetchRow() on a non-object in 
C:\Xampp\xampp\htdocs\www2\knowledge_db\searchnew.php on line ...

I am not shure that something should be wrong with the $result parameter since 
I have seen it in the PHP declaration and definition, see 
http://de.php.net/mysql_query below. I now that the return value of mysql_query 
is a boolean resp. a resource handler. In any case, I need the fetchRow 
functionality for correct work as listening to the rows on different pages. 




Another shorter possibility to print options of an ENUM as <select>-tag:
<?php
$result=mysql_query('SHOW COLUMNS FROM <your table> WHERE field=\'<you 
column>\'');
while ($row=mysql_fetch_row($result))
{
   foreach(explode("','",substr($row[1],6,-2)) as $v)
   {
     print("<option>$v</option>");
   }
}
?> 




best regards, Georg

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
> Hello 
> 
> I am pleased if someone could explain me the behaviour since is wrong the 
> following function call: ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, 
> $_SESSION["searchFormVars"]["offset"]+$rowCounter));

I am pleased if you'd **** off with the broken record (pun intended) georg
- you have had the answer 6 times or more now.


> 

--- End Message ---
--- Begin Message ---
àÃÒ¢Ò¶١ Licensed Windows XP Pro, win 98, 98 se, Office XP Small, Office 
XP Professional, Office Pro 2003 ¶Ù¡ÁÒ¡ ¢Í§á·éá¹è¹Í¹ 100 % 
µÔ´µèÍ  Paisarn  06-5881135
- Windows 95 ẺÁÕ CD ¤ÃºªØ´ 200 bath 
- Windows 98 book+COA only 800 bath 
- Windows 98 book+COA+CD 1,000 bath 
- Windows 98 SE book + COA + CD ÊÕ¢ÒÇãËÁè 1,500 bath 
- Windows 2000 Professional + CD  2,700 bath 
- Windows ME ¤ÙèÁ×Í + COA + CD 1,800 bath 
- Windows XP Home Edition ¤ÙèÁ×Í + COA 2,000 bath 
- Windows XP Home Edition ¤ÙèÁ×Í + COA + CD 2,700 bath
- Windows XP Professional ¤ÙèÁ×Í + COA 2,400 bath
- Windows XP Professional ¤ÙèÁ×Í + COA+CD 3,500bath
- Microsoft Office Pro 2003 7,500 bath
- Microsoft Office Basic 5500 
µÔ´µèÍ  ä¾ÈÒÅ  06-5881135   [EMAIL PROTECTED] 
«×éÍËÅÒªشÊèǹŴÂÔè§à¾ÔèÁ¤ÃѺ ºÃÔ¡ÒÃÊ觶֧·Õè ¡·Á.-µ¨Ç.¾ÃéÍÁãºàÊÃç¨ãËé 

--- End Message ---
--- Begin Message ---
hi, i'm working on a template system. Basically i'm building raw
contents in arrays and then put them in templates by some special
tags.

for loop systems my basic array structure is like this:
$array['key'][]['keyword'] = ...

for example, for a bulletin board system, array structure for
categories is something like this:
$array['categories'][]['text_category_name'] = ...

it is looped through database recordset, so final array for 2 categories can be:
$array['categories'][0]['text_category_name'] = 'programming'
$array['categories'][1]['text_category_name'] = 'life'

template file structure for loops is something like this (ex, categories):
<!-- loop|categories:bof -->
<tr>
  <td>[$text_category_name$]</td>
</tr>
<!-- loop|categories:eof -->

i can easily loop this template and replace [$text_category_name] for
every category set in the array. after removing the comment tags i get
the final content:

<tr>
  <td>programming</td>
</tr>
<tr>
  <td>life</td>
</tr>

But i'm stuck with nested loops. For example i want to put related
forums after each categories.

array structure is:
$array['categories'][0]['text_category_name'] = programming
$array['categories'][0]['forums'][0]['text_forum_name'] = php
$array['categories'][0]['forums'][1]['text_forum_name'] = ruby

$array['categories'][1]['text_category_name'] = life
$array['categories'][1]['forums'][0]['text_forum_name'] = music
$array['categories'][1]['forums'][1]['text_forum_name'] = sports

template structure is:
<!-- loop|categories:bof -->
<tr>
  <td>[$text_category_name$]</td>
</tr>
<!-- loop|forums:bof -->
<tr>
  <td>[$text_forum_name$]</td>
</tr>
<!-- loop|forums:eof -->
<!-- loop|categories:eof -->

i've written some functions, used them recursively but it didn't work.
actually i couldn't find the true logic. note that it isn't a limited
array. it can have messages under each forums, peoples under each
messages, so on..

help me find the true approach to handle this. thank you.

--- End Message ---
--- Begin Message ---
Hi,

I have been asked to look at extending one of my CMS systems to incorporate
integration to a library management system, as well as LDAP and Active
Directory. The requirement also asks for scanning and OCR of documents to be
controlled by the CMS.

Does anyone have any experience of implementing the scanning into a PHP
application?

MTIA

George

--- End Message ---
--- Begin Message ---
Probably nobody, as PHP is a Server Side Scripting Language.

-----Original Message-----
From: George Pitcher [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 27, 2006 7:16 PM
To: php-general@lists.php.net
Subject: [PHP] Controlling a scanner with PHP

Hi,

I have been asked to look at extending one of my CMS systems to incorporate
integration to a library management system, as well as LDAP and Active
Directory. The requirement also asks for scanning and OCR of documents to be
controlled by the CMS.

Does anyone have any experience of implementing the scanning into a PHP
application?

MTIA

George

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

--- End Message ---
--- Begin Message ---
[snip]
I have been asked to look at extending one of my CMS systems to
incorporate
integration to a library management system, as well as LDAP and Active
Directory. The requirement also asks for scanning and OCR of documents
to be
controlled by the CMS.

Does anyone have any experience of implementing the scanning into a PHP
application?
[/snip]

Will the scanner be connected to a server running PHP?

--- End Message ---
--- Begin Message ---
Maybe JavaScript can do it for you?

-----Original Message-----
From: George Pitcher [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 27, 2006 8:01 PM
To: Peter Lauri
Subject: RE: [PHP] Controlling a scanner with PHP

Peter,

I take it you have spoken to everyone on the list then?

I know that PHP is a server side language, but that doesn't mean that nobody
has been able to do what I need to do, just that they've used other non-php
tools.

George

> -----Original Message-----
> From: Peter Lauri [mailto:[EMAIL PROTECTED]
> Sent: 27 June 2006 8:56 am
> To: 'George Pitcher'; php-general@lists.php.net
> Subject: RE: [PHP] Controlling a scanner with PHP
>
>
> Probably nobody, as PHP is a Server Side Scripting Language.
>
> -----Original Message-----
> From: George Pitcher [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 27, 2006 7:16 PM
> To: php-general@lists.php.net
> Subject: [PHP] Controlling a scanner with PHP
>
> Hi,
>
> I have been asked to look at extending one of my CMS systems to
> incorporate
> integration to a library management system, as well as LDAP and Active
> Directory. The requirement also asks for scanning and OCR of
> documents to be
> controlled by the CMS.
>
> Does anyone have any experience of implementing the scanning into a PHP
> application?
>
> MTIA
>
> George
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Peter Lauri wrote:
Probably nobody, as PHP is a Server Side Scripting Language.

If there's one thing I hate it's needless pigeonholing. PHP is not a "Server Side Scripting Language". It is a scripting language for sure, but is by no means limited to being used on a server never mind on a web server.

As to the OPs question, assuming you are aware that PHP cannot control anything on the client-side if used on a web server, and assuming you are talking about a Windows-based machine, you will probably find there are COM objects you can use to control scanners. From the PHP side check here: http://php.net/com. For the actual interface to scanners I suggest you Google.

Sounds like a fun project, enjoy.

-Stut

--- End Message ---
--- Begin Message ---
On 6/27/06, George Pitcher <[EMAIL PROTECTED]> wrote:
Hi,

I have been asked to look at extending one of my CMS systems to incorporate
integration to a library management system, as well as LDAP and Active
Directory. The requirement also asks for scanning and OCR of documents to be
controlled by the CMS.

Does anyone have any experience of implementing the scanning into a PHP
application?

There *might* be something on the gtk side of things:

http://gtk.php.net/

I highly doubt it, but worth a look.

That's not going to help you do anything from a web server though,
php-gtk apps run from a desktop.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
I'm trying to create some functionality which requires FTPing onto another
server, using the php functions.

Doing the following comes up with a successful login, but cannot display the
current directory; yet when I FTP directory from the server which is serving
the php pages, it works fine.

// set up basic connection
$conn_id = ftp_connect($ftp_server, 21);
ftp_pasv($conn_id, true);

// login with username and password
$login_result = ftp_login($conn_id, $username, $password);

// check connection
if ((!$conn_id) || (!$login_result)) {

echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $username<br />";
exit;

} else {

echo "Connected to $ftp_server, for user $username<br />";

}

echo(ftp_pwd($conn_id)."<br />"); # Comes back with /

$buff = ftp_nlist($conn_id,"");

// close the FTP stream
ftp_close($conn_id); 

var_dump($buff); => comes back with bool(false)

exit;

Can anyone see what could be wrong?


Cheers

Nunners


--- End Message ---
--- Begin Message ---
I had many troubles with ftp_nlist since I discovered the "-a" option.

try this :

$buff = ftp_nlist($conn_id,"-a");


N F

James Nunnerley a écrit :
I'm trying to create some functionality which requires FTPing onto another
server, using the php functions.

Doing the following comes up with a successful login, but cannot display the
current directory; yet when I FTP directory from the server which is serving
the php pages, it works fine.

// set up basic connection
$conn_id = ftp_connect($ftp_server, 21);
ftp_pasv($conn_id, true);

// login with username and password
$login_result = ftp_login($conn_id, $username, $password);

// check connection
if ((!$conn_id) || (!$login_result)) {

echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $username<br />";
exit;

} else {

echo "Connected to $ftp_server, for user $username<br />";

}

echo(ftp_pwd($conn_id)."<br />"); # Comes back with /

$buff = ftp_nlist($conn_id,"");

// close the FTP stream
ftp_close($conn_id);
var_dump($buff); => comes back with bool(false)

exit;

Can anyone see what could be wrong?


Cheers

Nunners




--- End Message ---
--- Begin Message ---
Nope - unfortunately, no change, still the same problems, logging in but no
ftp_nlist or indeed ftp_rawlist

Cheers
Nunners

-----Original Message-----
From: nicolas figaro [mailto:[EMAIL PROTECTED] 
Sent: 27 June 2006 14:12
To: James Nunnerley
Cc: php-general@lists.php.net
Subject: Re: [PHP] FTP Problems

I had many troubles with ftp_nlist since I discovered the "-a" option.

try this :

$buff = ftp_nlist($conn_id,"-a");


N F

James Nunnerley a écrit :
> I'm trying to create some functionality which requires FTPing onto another
> server, using the php functions.
>
> Doing the following comes up with a successful login, but cannot display
the
> current directory; yet when I FTP directory from the server which is
serving
> the php pages, it works fine.
>
> // set up basic connection
> $conn_id = ftp_connect($ftp_server, 21);
> ftp_pasv($conn_id, true);
>
> // login with username and password
> $login_result = ftp_login($conn_id, $username, $password);
>
> // check connection
> if ((!$conn_id) || (!$login_result)) {
>
> echo "FTP connection has failed!";
> echo "Attempted to connect to $ftp_server for user $username<br />";
> exit;
>
> } else {
>
> echo "Connected to $ftp_server, for user $username<br />";
>
> }
>
> echo(ftp_pwd($conn_id)."<br />"); # Comes back with /
>
> $buff = ftp_nlist($conn_id,"");
>
> // close the FTP stream
> ftp_close($conn_id); 
>
> var_dump($buff); => comes back with bool(false)
>
> exit;
>
> Can anyone see what could be wrong?
>
>
> Cheers
>
> Nunners
>
>
>   

--- End Message ---
--- Begin Message ---
On 6/27/06, James Nunnerley <[EMAIL PROTECTED]> wrote:
I'm trying to create some functionality which requires FTPing onto another
server, using the php functions.

Doing the following comes up with a successful login, but cannot display the
current directory; yet when I FTP directory from the server which is serving
the php pages, it works fine.

// set up basic connection
$conn_id = ftp_connect($ftp_server, 21);
ftp_pasv($conn_id, true);

// login with username and password
$login_result = ftp_login($conn_id, $username, $password);

// check connection
if ((!$conn_id) || (!$login_result)) {

echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $username<br />";
exit;

} else {

echo "Connected to $ftp_server, for user $username<br />";

}

echo(ftp_pwd($conn_id)."<br />"); # Comes back with /

$buff = ftp_nlist($conn_id,"");

ftp_nlist requires a directory name. A blank string is not a directory name.

http://au.php.net/ftp_nlist

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---

Reply via email to