[PHP-DB] MySQL MaxDB mode

2004-02-20 Thread Kim Steinhaug
Hello!

Ive been studying some of the new features from mySQL and I noticed
that the timestamp autoupdate feature doesnt work in MaxDB mode
of mySQL.
ref : http://www.mysqlfreaks.com/mysql/manual_Reference.html

What I wonder is, whats the difference (in short words) of running in
MaxDB mode versus default installation? If MaxDB could be a
fedault installation later there should be no reason for me to let
mySQL autoupdate, rather hardcode as normal.

I always hardocde theese features, but it feels comfortable using
auto thingies, .) But only if theire not a problem in near future.

-- 
-- 
Kim Steinhaug
--
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
--
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
--

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



Re: [PHP-DB] Need some help please!

2004-02-20 Thread Mikael Grön
Hi.

First of all it's never a good idea to use ? instead of ?php. But  
anyway. Your loss. ;)

You will need to do a refresh of the page to be able to run an insert  
query.
The refresh will need to be made by the JavaScript and since I've  
refused to learn JavaScript, I can't help you with that. Remember also  
that the JS needs to send a variable containing the username to the PHP  
code.

Now, I haven't had enough coffee today, so this is the best I can give  
you:
snip
	?php
		mysql_connect($hostname,$mysqluser,$mysqlpassword);
		$username = $_POST['user']; // What ever your JS will send the  
variable in.
		mysql_query(insert into score (user,date) values (' . $username .  
','.date(Y-m-d).'););
	?
/snip

Also, you might want to parse the username through a few str_replace's  
before you insert.. removing stuff like '' and ''.

Good luck!

Mikael

PS: I apparently sent this the first time using the wrong FROM  
address.. So here it comes again. ;)



On Feb 20, 2004, at 03:16, JeRRy wrote:

Hi,

I have this code, comments below:

? include(../pages/setup.php);?
? login();?
? include(../pages/header.php);?
!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01
Transitional//EN
html
head
STYLE
.general3 {background-color:#33;z-index:4}
.general2 {background-color:#55;z-index:3}
.general1 {background-color:#77;z-index:2}
.general0 {background-color:#99;z-index:1}
/STYLE  
title/title
/head
body
?
include(./config.phtml);
include(./$languagefile);
mysql_connect($hostname,$mysqluser,$mysqlpassword);
$query = select * from kras_params;;
$result = mysql_db_query($database,$query);
$row = mysql_fetch_array($result);
//fill vars
$total = $row[kr_total];
$chance = $row[kr_chance];
$maxwins = $row[kr_max_wins];
$wins = $row[kr_wins];
$timesaday = $row[kr_timesaday];
$host = $REMOTE_ADDR;
$check = 1;
$q_checktimes = select count(*) from kras_users where
usr_ip='$host' and usr_date=CURDATE();;
$checktimes_result =
mysql_db_query($database,$q_checktimes);
$times = mysql_fetch_row($checktimes_result);
$error = ;
if ($times[0]  $timesaday) {
//poging toevoegen in database
$raisetimes = insert into kras_users
values('$host',CURDATE(),'$HTTP_SESSION_VARS[username]');;
$raiseresult = mysql_db_query($database,$raisetimes)
or die('error: raise times failed');
} else {
$error .= LI$txt_maxplay $timesaday.;
$check = 0;
}
if ($wins == $maxwins) {
$error = LI$txt_maxwon;
$check = 0;
}
if ($check) {
//aantal malen dat spel gespeeld is ophogen met 1
$raisetotal = update kras_params set
kr_total=(kr_total+1);;
$raiseresult = mysql_db_query($database,$raisetotal);

if ($total%$chance == 0) {
$raisewins = update kras_params set
kr_wins=(kr_wins+1);;
$raisewinsresult =
mysql_db_query($database,$raisewins) or die('error:
raise wins failed');
$winner = 1;
}

?
	SCRIPT
	sc=new
Array('gfx/crown.jpg','gfx/x.jpg','gfx/seven.jpg','gfx/ 
diamond.jpg','gfx/ruby.jpg','gfx/magic.jpg');
	z=new Array();
	
	function check() {
		var oDivs = document.all.tags(DIV);
		for (i=0; ioDivs.length; i++){	
			
			var scratched = true;
			if (oDivs(i).style.display != none 
oDivs(i).scratchable == true) {
scratched = false;
return false;
			}
		}
		if (scratched == true)  {

?

echo ($winner ? alert(\$txt_youwon!
$HTTP_SESSION_VARS[username]\) :
alert(\$txt_youlost\));
			?

		}
	}	
			
	function rnd() {
		return Math.floor(Math.random()*sc.length);
	}
	
	?
	if ($winner) {
		echo function scimgload() {;
		echo document.scratch1.src=sc[rnd()];;
		echo document.scratch2.src=document.scratch1.src;;
		echo document.scratch3.src=document.scratch1.src;;
		echo };
	} else {
		echo function scimgload() {;
		echo document.scratch1.src=sc[rnd()];;
		echo document.scratch2.src=sc[rnd()];;
		echo document.scratch3.src=sc[rnd()];;
		echo while (document.scratch2.src ==
document.scratch3.src) {;
		echo document.scratch3.src=sc[rnd()];;
		echo };
		echo };
	}
	?
	function scmetal() {
	for (i=0;i192;i++)
	document.all['M'+i].style.display=;
	}
	/SCRIPT
	
	SCRIPT FOR=window EVENT=onload LANGUAGE=JScript
	  scimgload();
	/SCRIPT
	
	h1centerfont color=blueTMC Scratch n
Match/font/H1
	
	DIV scratchable=false STYLE=position:
relative;height: 300
	
	SCRIPT
	// This script must be within the relatively
positioned DIV.
	for (p=0;p3;p++)
	for (i=0;i4;i++)
	for (j=0;j4;j++)
	for (k=0;k4;k++) {
	idn=p*64+i*16+j*4+k;
	document.write('DIV scratchable=true ID=M'+idn+'
onmouseover=style.display=\'none\';check();
CLASS=general'+i+'
STYLE=position:absolute;width:25;height:25;top:'+eval(0+j*25)+'; 
left:'+eval(125+p*125+k*25)+'/DIV');
	}
	/SCRIPT
	IMG SRC= NAME=scratch1 ID=img1
STYLE=position:absolute;top:0;left:125;width:100;height:100;z-index: 
0
	IMG SRC= NAME=scratch2 ID=img2
STYLE=position:absolute;top:0;left:250;width:100;height:100;z-index: 
0
	IMG SRC= 

RE: [PHP-DB] MS SQL 'Changed database context' error

2004-02-20 Thread Adam Voigt
Well, even though ignoring the error's (which is actually just an
informational message), you could call the error_reporting function
right above the line throwing the message, and then again below that
line, turning error_reporting back to the default level.



On Thu, 2004-02-19 at 16:38, Michael Flanagan wrote:
 Adam,  Thanks for the suggestions.  I don't want to ignore all error
 handling.  Later, I might get an error that I really don't want php to
 swallow due to either of your suggestions.
 
 Has anyone else run into this and solved it?
 
 Any idea why the following lines in the php.ini file don't work?
 mssql.min_error_severity = 11
 mssql.min_message_severity = 11
 
 Michael
 
 -Original Message-
 From: Adam Voigt [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 19, 2004 12:44 PM
 To: Michael Flanagan
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] MS SQL 'Changed database context' error
 
 
 Try putting the error suppressor (@) before the query, eg:
 
 @mssql_query
 
 Or, try setting the error reporting:
 
 error_reporting(0);
 
 
 
 On Thu, 2004-02-19 at 14:38, Michael Flanagan wrote:
  Thanks, Adam.
 
  I don't get the error in Enterprise manager.  MS has a KB article out that
  says that this message is informational.  I seem to remember that the
  article also says the message comes out some times, and not other times,
 but
  that you should just forget it.
 
  The particular SELECT statement I'm getting the message on is the second
  query in my script.  The other query is to the same db; in fact, it uses
 the
  exact same $db connection object.
 
  Any ideas on getting PHP to ignore this info message?
 
  Thanks again.
  Michael
 
  -Original Message-
  From: Adam Voigt [mailto:[EMAIL PROTECTED]
  Sent: Thursday, February 19, 2004 12:13 PM
  To: Michael Flanagan
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] MS SQL 'Changed database context' error
 
 
  This may not be the case, but I've seen this before when the PHP library
  didn't know how to express MS SQL's error, so it simply returns the last
  message sent which was the informational context change. If it is infact
  an error, you should be able to plug the query directly into Enterprise
  Manager to see MS SQL's take on the problem, so to speak. =)
 
  But again, this is all just in my past experience's, yours may differ
  greatly.
 
 
 
  On Thu, 2004-02-19 at 14:08, Michael Flanagan wrote:
   I'm getting the error Changed database context from MS SQL.  I see
   where this is supposedly just an informational message.  I've tried
   setting
  
   mssql.min_error_severity = 11
   mssql.min_message_severity = 11
  
   but to no avail.  What am I missing?  I don't mind the message so much,
   but php treats this as an error, and doesn't execute my query.
  
   I'm running php 4.3.3 for Windows; the SQL Server and web server are on
  the
   same machine.  I'm using PEAR:DB for the database access.
  
   Thanks.
  
   Michael Flanagan
   voice: (1) 303-674-2691
 fax: (1) 603-963-0704 (note '603' area code)
   mailto:[EMAIL PROTECTED]
  --
 
  Adam Voigt
  [EMAIL PROTECTED]
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 --
 
 Adam Voigt
 [EMAIL PROTECTED]
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
-- 

Adam Voigt
[EMAIL PROTECTED]

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



[PHP-DB] OCI8 Memory Leak?

2004-02-20 Thread Shawn Coomey
Hi folks-

 

I am building an application which uses OCI8 functions (abstracted with
PEAR::DB) to perform queries against an Oracle 9i database. Here's my
platform info:

 

Solaris 8 (SunOS 5.2) on a Sun Ultra II workstation

Oracle 9i

PHP 4.3.5RC2-dev

Apache 1.3.29

 

Here's my problem:

Everything works well, but over time the Apache httpd processes start to take
huge amounts of memory: for instance: I checked this morning and each of the
apache processes running were using over 125MB per instance, and the server
had slowed to a standstill. The processes upon restart use between 15-20MB
per instance.

 

Is there something in the Oracle client configuration or in php/pear that can
lead to this sort of memory problem?

 

Any help is greatly appreciated.

 

Shawn



[PHP-DB] Connect. Sharing + Postgres: More than 1000 postmasters produce 7 0.000 context switches

2004-02-20 Thread Gellert, Andre
Hello, 
we installed a new Postgres 7.4.0 on a Suse 9 system, which is running into
troubles with the system load. 
As it seems to be more a php connection sharing problem than postgres 
( as we discussed on the pg-general list ), i do a updated crosspost here.

The database/ldap server is used as a part of an extranet , based on 
Apache+PHP and has besides a ldap server no services running. The system has

dual xeon 2ghz and 2GB RAM.
While migrating all applications from 2 other postgres7.2 servers to the new
one, 
we became heavy load problems. 
At the beginning there where problems with to much allocated shared memory, 
as the system was swapping 5-10 mb / sec . So we now reconfigured the 
shared_buffers to 2048, which means 16mb overall , seems to be somehow low, 
but I can test it with higher values again next time.
We corrected higher values from sort_mem and vacuum_mem back to sort_mem=512
and
 vacuum_mem=8192 , too, to reduce memory usage, although we have
 kernel.shmall = 1342177280 and kernel.shmmax = 1342177280 .

Currenty i have limited the max_connections to 800, because every larger
value results in
a system load to 60+ and at least 20.000 context switches.

So much about the postgres background , now talk about connection pooling:

My problem is, that our apache produces much more than 800 open connections,

because we are using  15 diff. databases and apache seems to keep
connections to every 
database open , the same httpd-process has connected before.
Currently , at low-traffic time, i have 44 httpds running and 293
postmasters, which
are nearly _all_ idle , a ps ax gives me at maximum 2 or 3 Selects, all
others are waiting.

For now i solved it in a very dirty way, i limited the number and the
lifetime 
of each httpd process with those values :
 MaxKeepAliveRequests 10
 KeepAliveTimeout 2 
 MaxClients 100 
 MaxRequestsPerChild 300
 
We use php 4.3.4 and PHP 4.2.3 on the webservers. PHP ini says:
[PostgresSQL]
; Allow or prevent persistent links.
pgsql.allow_persistent = On
; Maximum number of persistent links.  -1 means no limit.
pgsql.max_persistent = -1
; Maximum number of links (persistent+non persistent).  -1 means no limit.
pgsql.max_links = -1

We are now running for days with an extremly unstable database backend...
Are 1.000 processes the natural limit on a linux based postgresql ?
How can I realize a more efficient connection pooling/reusing, or is the 
connection pooling php offers here more bad than good , because the
connections
of the large number of databases cannot be shared in a efficient way ?

Maybe it is advisable just to share the connections of the main
database(s), 
and to pg_connect the other running databases ?

Is it enough to convert the pg_pconnect in every script to pg_connect by
setting pgsql.allow_persistent = Off , or is this another effect ? 
I tested this, but at the moment i am in low-traffic-hours, so i cannot 
say anything pro or cons about this test.

thanks a lot for help and every idea is very welcome,
Andre

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



RE: [PHP-DB] OCI8 Memory Leak?

2004-02-20 Thread Shawn Coomey
Thanks a lot for the response, Greg. I poked around quite a bit in the
PEAR::DB source, and everything at first glance looks OK. Connections are
closed properly, etc. 

After doing a little more digging on the Web, I noticed a mention to remove
any reference to SERVER=DEDICATED from Oracle's tnsnames.ora file. I did,
and it seems to have helped... though I'm not convinced.

Thanks!

Shawn


-Original Message-
From: Greg Skouby [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 20, 2004 3:28 PM
To: Shawn Coomey
Subject: RE: [PHP-DB] OCI8 Memory Leak?

Hi Shawn,

We are using almost the exact same setup that you describe without the PEAR
abstraction. We host a moderate sized application on this box and it has
performed flawlessly. My first indication, though I don't know why it would
be happening, is that there is a problem in the PEAR abstraction level.


--Greg


-Original Message-
From: Shawn Coomey [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 20, 2004 11:38 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] OCI8 Memory Leak?

Hi folks-

 

I am building an application which uses OCI8 functions (abstracted with
PEAR::DB) to perform queries against an Oracle 9i database. Here's my
platform info:

 

Solaris 8 (SunOS 5.2) on a Sun Ultra II workstation

Oracle 9i

PHP 4.3.5RC2-dev

Apache 1.3.29

 

Here's my problem:

Everything works well, but over time the Apache httpd processes start to
take
huge amounts of memory: for instance: I checked this morning and each of the
apache processes running were using over 125MB per instance, and the server
had slowed to a standstill. The processes upon restart use between 15-20MB
per instance.

 

Is there something in the Oracle client configuration or in php/pear that
can
lead to this sort of memory problem?

 

Any help is greatly appreciated.

 

Shawn

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



Re: [PHP-DB] Need some help please!

2004-02-20 Thread JeRRy
Mikael,

Hi :)

 First of all it's never a good idea to use ?
 instead of ?php. But  
 anyway. Your loss. ;)

My loss?  Explain?  (all ears)  I've used only ? php
a few times and end it with ? ...  But I normally use
only ? and ? and have *never* had a problem with it.
 

But I am all ears knowing why though?  I have seen
alot of different ones but have no idea what they mean
to be totally honest, here are some.

Starting codes:

?
? php 
? php else:
? php4 // I am guessing for php4 but could be wrong
//

 You will need to do a refresh of the page to be able
 to run an insert  
 query.
 The refresh will need to be made by the JavaScript
 and since I've  
 refused to learn JavaScript, I can't help you with
 that. Remember also  
 that the JS needs to send a variable containing the
 username to the PHP  
 code.

Bugger, can anyone else assist me here, the query part
I know how to do.  Just need help refreshing maybe to
the same file but use a if extension like this:

samefile.php?winner=WINNER CODE GOES HERE

WINNER CODE I could generate automatically when a game
is done, so if a winner it will update to the db with
the winner code and where someone hits the above page
it will look for that code again, if can't find it
will not generate the credits.  If it's found it will.

 Now, I haven't had enough coffee today, so this is
 the best I can give  
 you:

I've had none . :P  (yet!)

 Also, you might want to parse the username through a
 few str_replace's  
 before you insert.. removing stuff like '' and ''.

Actually I grab the username from a session in the
setup.php file. :)  So I can grab it quite easily.

 Good luck!

Thanks. :)

 PS: I apparently sent this the first time using the
 wrong FROM  
 address.. So here it comes again. ;)

Your not alone, happened to me also. ;)

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

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



[PHP-DB] Re: PEAR DB 1.6.0 has been released

2004-02-20 Thread Justin Patrin
I think you're confusing the issue. PEAR DB does support many databases, 
but it only loads the code for the ones that you are currently using. So 
if you're using one database it is effectively a one database API.

Jakes wrote:

What is performance like using this class? I've gone through the class and
it just seams to be over kill, for a DB API (13 databases).
Are there any time stats showing the different time in using a single DB API
class to the PEAR class.
Thanks

Daniel Convissor [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
[This has be cross-posted. Be careful when following up, please.]

Greetings:

Crack open the beer, PEAR DB 1.6.0 is here!  (Hey, I'm a bit giddy
with excitement that my intense work during the past seven weeks
has come to fruition.)
For those unfamiliar with PEAR DB, it's a package of PHP classes
that provide an object oriented API with common methods of accessing
thirteen of PHP's database driver extensions:
   dBase, FrontBase, InterBase, Informix, mSQL, MS SQL Server,
   MySQL, Oracle, ODBC (tested with DB2 and Access), PostgreSQL,
   SQLite and Sybase.
Key links for PEAR DB:

Download:http://pear.php.net/get/DB
Change Log:  http://pear.php.net/package-changelog.php?package=DB
Manual:  http://pear.php.net/manual/en/package.database.php
Home Page:   http://pear.php.net/package/DB
Notable changes since 1.5.0RC2 include:

   * New portability features, making it possible to write
 applications which can be easily ported between DBMS's.
   * Tons of bug fixes, making the package actually work for more
 than just MySQL systems.
   * Improved error reporting.

   * Getting prepare/execute to work the same way for all DBMS's
 and allow escaping of placeholder characters.
   * Deploying tableInfo() in more drivers and officially moving
 it from DB_result to DB_common.  See the documentation for
 proper usage.
   * Making the test suite simpler to use and work on both
 windows and *nix platforms.
   * Various optimizations, several of which were uncovered
 using Zend Studio's Code Analyzer.
   * Countless documentation corrections.

   * Full PHP 5 compatibility.

   * Requiring PHP to be at version 4.2.0 or higher.

   * Deprecating quote() and quoteString().

If you're one of the lucky few people using PHP's mysqli extension,
do note that the DB file/class has been renamed from mysql4 to mysqli,
but the online documentation won't reflect this modification until
they're rebuilt on Sunday.  Similarly, there are a few other features
and documentation bugs that won't show up there until then either.
Is Dutch, German or Russian your native language?  The manual needs
translating into these languages.  Join in by signing up for the
pear-doc mailing list at http://pear.php.net/support.php.
For those of you in and around New York City this coming
Tuesday, February 24th, I'll be giving a presentation about this at
the NYPHP meeting.  See http://nyphp.org/ for more info.
If you like the changes I've made to DB since version 1.5.0RC2, make
a donation: http://www.analysisandsolutions.com/donate/donate.htm
Enjoy,

--Dan

PS:  I'm not on this list/newsgroup.  Just posting this as an
announcement.  So, if you wish to contact me, please do so directly
or via cc.
--
T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
   data intensive web and database programming
   http://www.AnalysisAndSolutions.com/
4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409


--
--
paperCrane Justin Patrin
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] help with check boxes (php)!

2004-02-20 Thread karl james
Hello guys,

 

I was trying to create a table that would include check boxes.

Right now I have drop down list, but I since changed my mind

As I think check boxes would be the way to go forward on this 

Project

It will be used to select a player to make a trade or to release 

A player. And you should be able to choose multiple players

at once.

 

Here is my current code:

 

Could you guys show me how to add the check boxes in so that this 

Will work for me?

http://ircphp.com/235

 

Please email directly down below.

The site is theufl.com

Draqonqueen/kalizora 

Are the test users names and passwords so far!

For the login if you want to look at the team page.

And please advise on any other, always looking to improve the site.

 

 

 

 

 

 

Karl James

(TheSaint)

 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]

 http://theufl.com/ http://theufl.com/