[PHP] Re: Problems with MySQL-Link [3:14370:14592] (Solved)

2002-02-12 Thread Berthold

Hi all,

Do not use || instead of or !!!

Example:
$result = mysql_query(select now()) OR die (mysql_error());

-- 
Berthold


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




Re: [PHP] Re: [PHP General] RE: Problems with MySQL-Link [3:14370:14592]

2002-02-01 Thread Berthold

Hi again!

If it would be so simple I would not ask...

OK, once more:
#!/usr/local/bin/php -q
?php
$link1 = mysql_connect(localhost,user,passwd)
  || die (Fehler! Zeile .__LINE__.:\n.$php_errormsg.\n.mysql_error());
echo Link 1: $link1\n;
if (mysql_select_db(test, $link1)) {
   echo Successful select of test\n;
} else {
   echo Failed to select test\n;
   die (Fehler! Zeile .__LINE__.:\n.mysql_error().\n);
}
?
gives this output:
Link1: 1
Warning: Supplied argument is not a valid MySQL-Link resource in
/home/bt/bin/test.php on line 5
Failed to select db
Fehler! Zeile 9:

And once again I describe it:
I've tested all settings for MySQL in the php.ini.




Jason Wong wrote:

 On Friday 01 February 2002 15:38, Berthold wrote:
 
Hi!

Thank you.
But I cannot use that $link1 and/or $link2 to select two databases on
different servers...
If I use $link1 the first time to select the first database on the first
server I got that error. But without that $link1-variable AND only one
connection in the script it works.

And it makes no sense if I use it as shell-prog or with Apache-Builtin-PHP.

eg:
#!/usr/local/bin/php -q
?php
$link1 = mysql_connect(localhost,a);
echo 'Link 1: '.$link1 .'BR';
if (mysql_select_db(test, $link1)) {
  echo 'Successful select of testBR';
} else {
  echo 'Failed to select testBR';
}
?
gives this output:
Warning: Supplied argument is not a valid MySQL-Link resource in
/home/bt/bin/test.php on line 4

 
 Try:
 
  $link1 = mysql_connect(localhost,a) or die (Cannot connect to db!); 
 
 If it dies, then you know you have a problem connecting to the db.
 
 If you follow the examples in the code with regards to the DB functions they 
 all have a die() statement on the end for debugging purposes. It's there to 
 help you.
 
 In this case your real problem is most likely that you're not giving the 
 correct number of parameters to mysql_connect($host, $user, $password).
 
 Again, proper use of die() would have quickly helped you track down where the 
 real problem was. Instead of trying to figure out what is wrong with line 4!
 
 hth
 


-- 
Berthold


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: [PHP General] RE: Problems with MySQL-Link [3:14370:14592]

2002-02-01 Thread Berthold

Hi!

1) Yes of course. I only have to delete the $link-variables...
But then - of course - I can only use the last connection.

2) It made no sense. Shell or Apache.
And the settings in php.ini are '-1' for 'unlimited'.
And I use the right php.ini, even with the shell-version.

Jason Wong wrote:

 On Friday 01 February 2002 16:23, Berthold wrote:
 
Hi again!

If it would be so simple I would not ask...

OK, once more:
#!/usr/local/bin/php -q

 
 
 1) Has the mysql functions ever worked for you on that system?
 
 2) Are you only get this problem when using php from the command line?
 
 
 


-- 
Berthold


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: [PHP General] RE: Problems with MySQL-Link [3:14370:14592]

2002-01-31 Thread Berthold

So,

I've testet all possible I found in my brain...
CGI or Apache module: same error
mysql_connect or mysql_pconnect: same error
Variing settings in php.ini: same error

How can I solve that problem?
BTW: Here I describe it again:
Connecting to a database works well: ok
Working with that database: ok
Using the additional $link-Parameter: false
Not a valid resource id ...

And it does not matter how many different links with different servers I 
use! The resource-id is always '1'.

Strange...



Metin Arman wrote:

 http://www.zend.com/phorum//read.php?num=3id=14592thread=14370
 
 Sorry, Berthold!
 
 I can't think of anything else either.
 And now, I saw also in your quot;phpinfoquot;-page 
 that you are running Php in CGI mode.
 And that explains that quot;mysql.allow_persistentquot; shows quot;Offquot;.
 When Php is running in CGI mode - persistent connections are not possible.
 
 Anyhow, tell me if you solve your problem!
 It's interesting what causes it.
 
 Regards
 Metin
 
 
 


-- 
Berthold


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: [PHP General] RE: Problems with MySQL-Link [3:14370:14592]

2002-01-31 Thread Berthold

Hi!

mysql_error returns nothing...

The error arrives while selecting the database via:

$link = mysql_connect(host,user,passwd);
mysql_select_db(bla, $link);

echo $link returns always '1'!




David Robley wrote:
  In article [EMAIL PROTECTED], [EMAIL PROTECTED] says...
 
 So,
 
 I've testet all possible I found in my brain...
 CGI or Apache module: same error
 mysql_connect or mysql_pconnect: same error
 Variing settings in php.ini: same error
 
 How can I solve that problem?
 BTW: Here I describe it again:
 Connecting to a database works well: ok
 Working with that database: ok
 Using the additional $link-Parameter: false
 Not a valid resource id ...
 
 And it does not matter how many different links with different servers I
 use! The resource-id is always '1'.
 
 Strange...
 
 
  Not a valid resource ID usually means a problem with the query - in fact
  this might be in the FAQ. Use mysql_error() after the database query to
  see if mysql returns a useful error.
 
 


-- 
Berthold



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: [PHP General] RE: Problems with MySQL-Link [3:14370:14592]

2002-01-31 Thread Berthold

Hi!

Thank you.
But I cannot use that $link1 and/or $link2 to select two databases on 
different servers...
If I use $link1 the first time to select the first database on the first 
server I got that error. But without that $link1-variable AND only one 
connection in the script it works.

And it makes no sense if I use it as shell-prog or with Apache-Builtin-PHP.

eg:
#!/usr/local/bin/php -q
?php
$link1 = mysql_connect(localhost,a);
echo 'Link 1: '.$link1 .'BR';
if (mysql_select_db(test, $link1)) {
echo 'Successful select of testBR';
} else {
echo 'Failed to select testBR';
}
?
gives this output:
Warning: Supplied argument is not a valid MySQL-Link resource in 
/home/bt/bin/test.php on line 4

I don't know what to do...



David Robley wrote:

 In article [EMAIL PROTECTED], [EMAIL PROTECTED] says...
 
Hi!

mysql_error returns nothing...

The error arrives while selecting the database via:

$link = mysql_connect(host,user,passwd);
mysql_select_db(bla, $link);

echo $link returns always '1'!




David Robley wrote:
  In article [EMAIL PROTECTED], [EMAIL PROTECTED] says...
 
 So,
 
 I've testet all possible I found in my brain...
 CGI or Apache module: same error
 mysql_connect or mysql_pconnect: same error
 Variing settings in php.ini: same error
 
 How can I solve that problem?
 BTW: Here I describe it again:
 Connecting to a database works well: ok
 Working with that database: ok
 Using the additional $link-Parameter: false
 Not a valid resource id ...
 
 And it does not matter how many different links with different servers I
 use! The resource-id is always '1'.
 
 Strange...
 
 
  Not a valid resource ID usually means a problem with the query - in fact
  this might be in the FAQ. Use mysql_error() after the database query to
  see if mysql returns a useful error.

 
 Guess I misread your question. However, a litle playing around with this 
 script
 
 ?php
 $link1 = mysql_connect(localhost,a);
 $link2 = mysql_connect(localhost);
 echo 'Link 1: '.$link1 .'BR';
 echo 'Link 2: '.$link2 .'BR';
 if(mysql_select_db(test, $link1)) {
   echo 'Successful select of testBR';
   }else{
   echo 'Failed to select testBR';
   }
 if(mysql_select_db(test2, $link2)) {
   echo 'Successful select of test2BR';
   }else{
   echo 'Failed to select test2BR';
   }
 
 ?
 which gives this output
 Link 1: Resource id #1
 Link 2: Resource id #2
 Successful select of test
 Successful select of test2
 
 seems to indicate that php is smart enough not to open a new link even if 
 requested if there is already a link for the user! Removing the a in 
 the first mysql_connect gives me two links with a resource ID of 1.
 
 I can force errors of course by feeding a wrong username/password which 
 eventually leads to a 'Not a valid resource id' error but has other error 
 messages as well. You aren't by chance hiding other error responses by 
 using @ or 'or die'?
 
 


-- 
Berthold


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Link-Identifyer MySQL Problem

2002-01-17 Thread Berthold

Hello!

I have a problem with the connection-identifyer, comming from mysql_connect().

Everything worked well until I add a second MySQL-Server.
To do that I have to add the link-identifyer. OK.

This must be a bug in PHP:
Warning: Supplied argument is not a valid MySQL-Link resource...
because without that link it works well!

I use php 4.1.1 on Linux.

The value of link is '1'. The second link is '1' too!

Is there a php.ini-setting for allowing only one connection???
-- 
Berthold


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Link-Identifyer MySQL Problem

2002-01-17 Thread Berthold

Hello again!

Yes, there is a setting!
But the value is '-1' for 'unlimited'

It seems that mysql_connect returns always 'false' or '1'.

Strange...


Berthold wrote:

 Hello!
 
 I have a problem with the connection-identifyer, comming from 
 mysql_connect().
 
 Everything worked well until I add a second MySQL-Server.
 To do that I have to add the link-identifyer. OK.
 
 This must be a bug in PHP:
 Warning: Supplied argument is not a valid MySQL-Link resource...
 because without that link it works well!
 
 I use php 4.1.1 on Linux.
 
 The value of link is '1'. The second link is '1' too!
 
 Is there a php.ini-setting for allowing only one connection???


-- 
Berthold


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] disable_functions... Was: about your mail on php list

2002-01-16 Thread Berthold

Hello,

disable_functions still works ONLY via setting in php.ini.
I think this is a bug.

ini_set(disable_functions, phpinfo);
has no effect,

php_value_admin disable_functions phpinfo
shows the correct output from phpinfo with one line for
disable_functions phpinfo...
At least this is a bug.

prune wrote:

 Hi,
 
 I'm having the same problem as you mentionned.
 I can't find any answer on the list archives...
 
 is the problem still happening with php 4.1 ?
 is this a bug, or a feature ?
 
 Thanks,
 Cheers,
 
 Prune
 
 
 --
 List: php-general
 Subject:  [PHP] Problem with disable_functions
 From: Berthold Tenhumberg [EMAIL PROTECTED]
 Date: 2001-09-20 9:29:53
 [Download message RAW]
 
 Hi all!
 
 Did I find a bug?
 
 Disabling the function 'system' per php.ini works well. OK.
 
 Disabling the same function per Apache-directive does not. Why?
 
 php_admin_value disable_functions system
 --=20
 =20
 (live long and prosper...)
 
 
 
 


-- 
Berthold


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] how to free some memory

2001-12-07 Thread Berthold

Hello!

How can I free some memory after using it in an huge array?

Testing with $oldX = array(); doesn't even free the memory... :-(

-- 
Berthold


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] ? print $val; ?

2001-11-28 Thread Berthold

php version = 4 I think

faeton wrote:

 Does anyone know that ? print $val; ? is equal ?=$val?, eh? :)
 Just wanted you to know :)
 
 
 
 Ivan 'Faeton aka xetrix' Danishevsky
 ICQ(240266) [EMAIL PROTECTED] www.xemichat.com
 
 
 


-- 
Berthold


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] First CGI, then PHP

2001-11-15 Thread Berthold

Hi!

Is it possible to add PHP-code into the html-templates of ht://dig?

The problem is the execution after or before the CGI-prog has run.
Of course I need 'after'. But how can I do that?

What is the default order in a builtin-PHP?
-- 
Berthold
(live long and prosper...)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Performance with encoded files

2001-06-19 Thread Berthold Tenhumberg

Hi!

I've testet the performance on plain code and encoded code.
Both done with the optimizer 1.1.0 on the same maschine.

The encoded skript needs 30 % more time to execute!
Is that ok?
-- 
B Tenhumberg
 
(live long and prosper...)