RE: [PHP-DB] Relational database

2002-03-21 Thread Hunter, Ray

Try this:

SELECT ccsd.Description, ccsd.Impact, ccsd.Isolation FROM ccsd, log WHERE
ccsd.logccsd=log.logccsd;

You cannot specify a database is = to a row...


Thank you,

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: Ron [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, March 21, 2002 6:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Relational database


I am trying to get fields from 2 different tables that have the same field
name to pull the records from one table For example
mysql_connect($DBhost,$DBuser,$DBpass) or die(Unable toconnect to
database);
@mysql_select_db($DBName) or die(Unable to select database $DBName);
$sqlquery1 = mysql_query(SELECT Description, Impact, Isolation . FROM
ccsd, log WHERE ccsd=log.logccsd);

while ($query = mysql_fetch_array($sqlquery1)) {
 $CCSD = $query[CCSD];
 $Description = $query[Description];
 $Impact = $query[Impact];
 $Isolation = $query[Isolation];
}
This code is not working.help please.yes I am a newbie!



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



RE: [PHP-DB] textarea and mysql query

2002-03-18 Thread Hunter, Ray

Try this:

form name=wel_area method=post action=index_confirm.php3 target=box
?php
$record = mysql_fetch_array(@mysql_query(SELECT wel_area FROM
cm_index,$dbh)); 
echo textarea name='wel_area' value='.$record['wel_area'].' cols='25'
rows='8'/textareabrinput type='submit' name='save'
value='save'br\n; 
?
/form

If not then let me know...


Thank you,

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: jas [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, March 17, 2002 11:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] textarea and mysql query


I need some help with a query to place the results within a text area...
here is the code and so far every time I try it out all that happens is it
displays the textbox but not the results of the query. form name=wel_area
method=post action=index_confirm.php3 target=box
?php
$record = mysql_fetch_array(@mysql_query(SELECT wel_area FROM
cm_index,$dbh)); echo textarea name='wel_area'
value='{$record['wel_area']}' cols='25' rows='8'/textareabrinput
type='submit' name='save' value='save'br\n; ?
  /form
Any help would be great.
Jas



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



RE: [PHP-DB] textarea and mysql query

2002-03-18 Thread Hunter, Ray

What is the result of $record['wel_area'].  If this is a multidimensional
array then you will need to access it differently...

Example:
echo $record[0][0].\n;

Try this is your text area and see if that comes out...



Thank you,

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: jas [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 18, 2002 12:07 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] textarea and mysql query


Yeah that didn't work either... If I put the same value (
value=\{$record['wel_area']}\ ) on a text line it works just fine however
using the same value for a textarea doesnt give me any results nor does it
give me an error message to go on, if there is a way to output the code to
the screen like a dos echo command that would help out alot.  Thanks in
advance, Jas Ray Hunter [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Try this:

 form name=wel_area method=post action=index_confirm.php3
target=box
 ?php
 $record = mysql_fetch_array(@mysql_query(SELECT wel_area FROM 
 cm_index,$dbh)); echo textarea name='wel_area' 
 value='.$record['wel_area'].' cols='25' 
 rows='8'/textareabrinput type='submit' name='save' 
 value='save'br\n; ?
 /form

 If not then let me know...


 Thank you,

 Ray Hunter
 Firmware Engineer

 ENTERASYS NETWORKS


 -Original Message-
 From: jas [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, March 17, 2002 11:54 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] textarea and mysql query


 I need some help with a query to place the results within a text 
 area... here is the code and so far every time I try it out all that 
 happens is it displays the textbox but not the results of the query. 
 form
name=wel_area
 method=post action=index_confirm.php3 target=box
 ?php
 $record = mysql_fetch_array(@mysql_query(SELECT wel_area FROM 
 cm_index,$dbh)); echo textarea name='wel_area' 
 value='{$record['wel_area']}' cols='25' rows='8'/textareabrinput 
 type='submit' name='save' value='save'br\n; ?
   /form
 Any help would be great.
 Jas



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




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



RE: [PHP-DB] optimization (another tack)

2002-03-04 Thread Hunter, Ray

If you are using php and a database you can add more memory to the script
and optimize the database.  I only use postgres databases for all my large
data so I can let you know how to optimize postgres...



Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: Aron Pilhofer [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 04, 2002 9:02 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] optimization (another tack)


Let me try this again more generally. I am trying to optimize a function in
PHP that handles very large result sets, which are transferred to arrays,
and that does some extremely heavy lifting in terms of calculations on those
arrays. By design, it iterates through each possible combination of two
result sets, and does some calculations on those results. As you can
imagine, the numbers get quite large, quite fast; sets of 500 by 1000
necessitate a half-million calculations.

So, short of rewriting this function in C, which I cannot do, are there any
suggestions for optimizing. For example:

1) is there any advantage to caching an array as a local file?
2) the script pumps the results of the calculations into a new table.. would
it be faster to dump it into a local file instead?
3) is there any advantage to executing the script as a CGI? (does that make
sense? I don't know if I know the correct jargon here...)

Any other tips folks have for scripts that handle a lot of calculations
would be greatly appreciated.

Thanks in advance.



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



RE: [PHP-DB] optimization (another tack)

2002-03-04 Thread Hunter, Ray
Title: Message



Here 
is general information on postgres: http://www.ca.postgresql.org/docs/aw_pgsql_book/index.html

Here 
is an optimization file included: This was not written by 
me!!!

Let 
me know if you have questions...s
Ray 
Hunter
Firmware 
Engineer
ENTERASYS 
NETWORKS

  
  -Original Message-From: Aron Pilhofer 
  [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 9:10 
  AMTo: Hunter, RaySubject: RE: [PHP-DB] optimization 
  (another tack)
  That 
  would be great! Thanks.
  
  [Aron Pilhofer]
  -Original 
  Message-From: Hunter, Ray 
  [mailto:[EMAIL PROTECTED]]Sent: Monday, March 04, 2002 11:04 
  AMTo: 'Aron Pilhofer'; [EMAIL PROTECTED]Subject: RE: 
  [PHP-DB] optimization (another tack)
  
If you are using php and a database you can add more memory 
to the script and optimize the database. I only use postgres databases 
for all my large data so I can let you know how to optimize 
postgres...
Ray Hunter Firmware Engineer 

ENTERASYS NETWORKS 
-Original Message- From: 
Aron Pilhofer [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 04, 2002 9:02 AM 
To: [EMAIL PROTECTED] Subject: 
[PHP-DB] optimization (another tack) 
Let me try this again more generally. I am trying to 
optimize a function in PHP that handles very large result sets, which are 
transferred to arrays, and that does some extremely heavy lifting in terms 
of calculations on those arrays. By design, it iterates through each 
possible combination of two result sets, and does some calculations on those 
results. As you can imagine, the numbers get quite large, quite fast; sets 
of 500 by 1000 necessitate a half-million calculations.
So, short of rewriting this function in C, which I cannot 
do, are there any suggestions for optimizing. For example: 
1) is there any advantage to caching an array as a local 
file? 2) the script pumps the results of the 
calculations into a new table.. would it be faster to dump it into a local 
file instead?
3) is there any advantage to executing the script as a CGI? 
(does that make sense? I don't know if I know the correct jargon 
here...)
Any other tips folks have for scripts that handle a lot of 
calculations would be greatly appreciated. 
Thanks in advance. 
-- PHP Database Mailing List (http://www.php.net/) 
To unsubscribe, visit: http://www.php.net/unsub.php 


Optimizing Postgresql

Ericson Smith 

Following Tim Perdue's excellent article on the comparison between MySQL and 
Postgresql, 
I decided to take a shot at installing and using this database. For most of our work I 
use MySQL 
and will continue to do so, because of its ease of use and unrivaled select query 
speed, 
and also because there is no point in trying to mess around with production systems 
that already work fine. 

But some new projects suffered greatly from MySQL's table locking feature when I 
needed 
to update data (which I do a lot). Here are my adventures in setting up a Postgresql 
database server. 

Our configuration for a dedicated Postgresql server was: 

Redhat 7.1 
Dual PIII 650Mhz System 
512MB RAM 
18Gig SCSI drive for the postgresql data partition 

Downloading and Installing
I downloaded and installed the 7.1.2 RPM's from http://postgres.org without any 
trouble. 
For a server installation, I only installed: postgresql-server and postgresql-7.1.2 
(base). 

I then started the server up and running by executing: 
/etc/init.d/postgresql start 

A small sized database was ported from MySQL (three tables totaling about 5000 
records). 
I created sufficient indexes for postgresql's optimizer to use, and modified our C 
application 
to use the postgresql C client interface for a small CGI program that would brutally 
query 
this table. This small CGI program receives thousands of queries per minute. 



Optimizing
One of the first things I noticed after turning on the CGI program, was that although 
queries 
were returned almost as fast as from the previous MySQL based system, the load on the 
server was much higher -- in fact almost 90-percent! Then I started to go down into 
the 
nitty-gritty of things. I had optimized MySQL before by greatly increasing cache and 
buffer 
sizes and by throwing more ram towards the problem. 
The single biggest thing that you have to do before running Postgresql, is to provide 
enough 
shared buffer space. Let me repeat: provide enough buffer space! Let's say you have 
about 
512MB of ram on a dedicated database server, then you need to turn over about 
75-percent 
of it to this shared buffer. Postgresql does best when it can load most or -- even 
better -- all 
of a table into its shared memory space. In our case, since our database was fairly 
small, 
I decided to allocate 128MB of RAM towards the shared buffer space. 

The file /var/lib/pgsql/data/postgresql.conf contains settings for the database 
server. 
Postgresql

RE: [PHP-DB] PHP and big production database apps ?

2002-02-22 Thread Hunter, Ray

You can get a complicated as you want.  I am running postgres and php for
our Quality assurance department that has a web based front-end portal with
the postgres and mysql backend.  I use the postgres database for the
sensitive database (testing, cvs, test-cases, etc.)  while I use mysql for
the front-end portal and text information (documents).  I run intense data
calculations and statistics with postgres and have php create charts and
graphs.  I have also started writing gui apps with php-gtk for direct
database access.  This has worked out great.

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: Pagin [mailto:[EMAIL PROTECTED]] 
Sent: Friday, February 22, 2002 3:21 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP and big production database apps ?


Hi all,

I am absolutly new to PHP and PostgreSQL. So far I developed production
database apps for managing production in production comapny(using Clipper
and DBF files). Now my boss has got idea to try using PHP and PostgreSQL to
create another production apps. These apps should run localy in company,
collect all infos from production (time, quantity, persons, machines,
production steps, parts, material and so on). Later these infos lets us
build statistics, production plans, control people, calculate prices.

And my general question is: can I develop complicated database apps for
production company using PHP and PostgreSQL? How complicated screens can I
build.? What about designing complex printings? Are there any additionall
PHP libraries for building menus, screen controls (buttons, radiobuttons,
checkboxes, dropdownlists, window tabs and so on), designing printing
reports, handling bar codes and handy scanners, creating charts on screen,
any other? what PHP language or PostgreSQL limitation can I face?

Apps I developed so far has got about 25.000 code lines and uses about 100
releted tables

Thanks a lot for your replays.

Wojtek



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



RE: [PHP-DB] How do I add multiple var to a if clause ?

2002-02-21 Thread Hunter, Ray

If you are looking for speed and efficiency in your code then Mat has
touched on it.

This example will execute the fastest...

If( $var = 3 )
{}

If you do or statements or and statements all of the if statement needs to
be evaluated.  So if you have an or or and all the statements in the if
clause needs to be evaluated.

Just some technical crap for the insane...

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: matt stewart [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, February 21, 2002 3:47 AM
To: php List
Subject: RE: [PHP-DB] How do I add multiple var to a if clause ?


either
if (($var = 3)($var = 1)){
}
if you want it to just be somewhere between one and 3,
or

$my_array = array (1, 2, 3);
if (in_array($variable, $my_array)) {
}
if you want it to be just one of those exact values.


-Original Message-
From: Dave Carrera [mailto:[EMAIL PROTECTED]]
Sent: 21 February 2002 10:40
To: php List
Subject: [PHP-DB] How do I add multiple var to a if clause ?


Hi All

If($var == 1,2,3){
}
This is wrong so what is the right way.

I am try to find out a if var equals either 1 2 or 3 do something type thing
but cant find answers anywhere

Thanks in Advance

Dave Carrera
Php / MySql Development
Web Design
Site Marketing
http://www.davecarrera.com
 



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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.323 / Virus Database: 180 - Release Date: 08/02/02
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.323 / Virus Database: 180 - Release Date: 08/02/02
 

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



RE: [PHP-DB] mysql connect, while and close big problem

2002-02-21 Thread Hunter, Ray

What type of connections are you making persistent or non-persistent?

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: Killer Angel Clark [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, February 21, 2002 10:17 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql connect, while and close big problem


I make a connection A to get an array of result.
Then use a while loop to use the array.
In the while loop, I use the data to select other data by making a new
connection. After printing the data, I close this new connection. After the
while loop, I close the first connection too.

If only have the first connection, it has no problem.
But with the select in the while loop and close the new connection, it has
an error on closing. Does anyone know why and how to fix it??



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



RE: [PHP-DB] Secure Encrypt/Decrypt Functions

2002-02-21 Thread Hunter, Ray

You can use the mcrypt functions of php.  You can look in the php manual
here: http://www.php.net/manual/en/ref.mcrypt.php .  You will also need to
compile php with mcrypt.  I use mcrypt with no problems.  



Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, February 21, 2002 11:59 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Secure Encrypt/Decrypt Functions


Does anyone know of a fairly simple, but secure technique for encrypting and
decrypting text?

- Jonathan

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



RE: [PHP-DB] How to make logout from database server (ORACLE for example) when user closes its session

2002-02-19 Thread Hunter, Ray

Do not use persistent connections to the database.  Use non-persistent
connections and make sure to close them.  Persistent connections will linger
around for a while then close.  Also, check the documentation on oracle
concerning persistent connections http://otn.oracle.com .

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: Vlad A. Chernikhoff [mailto:[EMAIL PROTECTED]] 
Sent: Monday, February 18, 2002 11:10 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] How to make logout from database server (ORACLE for
example) when user closes its session


Hi all
Is it possible to track such situations when http user closes connection to
HTTP server to close opened persistent connections to the database? This
connections is still active all the time (if using php not as CGI but as
module for Apache) and when user trying to login next time PHP uses
previously opened (by OCIPLogin for example) persistent connection (the same
connection resource) - but this connection may be broken from the server
side if its idle time is too long. So I found only way to restart my Apache
+ modphp from time to time. :(

Thanks, Vlad





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



RE: [PHP-DB] Problem with file() function

2002-02-19 Thread Hunter, Ray

If you are behind a firewall or proxy, you will not be able to connect to
www.php.net.  If you are not behind a firewall or proxy and you are getting
php_hostconnect errors then you need to make sure that you can get to the
php.net other than with your browser.

You can also try using fopen() as well...


Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: Hayan Al Mamoun [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 19, 2002 3:58 AM
To: PHPList (E-mail)
Subject: [PHP-DB] Problem with file() function


Dear sirs, Please help with the follows:
When I'm trying to execute this code:

$fcontents = file ('http://localhost/');
while (list ($line_num, $line) = each ($fcontents)) {
echo bLine $line_num:/b;  . htmlspecialchars ($line) . br\n; }

it runs perfectly, but when I try to change to:

$fcontents = file ('http://www.php.net/');
while (list ($line_num, $line) = each ($fcontents)) {
echo bLine $line_num:/b;  . htmlspecialchars ($line) . br\n; }

it dosn't work, Can you tell why please...

Best Regards
Hayan


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



RE: [PHP-DB] A good tutorial

2002-02-19 Thread Hunter, Ray

It depends on the database that you are using.  One of the best databases I
have used for storing images has been with oracle.  You need to look up the
documentation on there web site.  http://otn.oracle.com.  As for the other
databases, I have not used images with them.  On oracle I have used BLOBS
and CLOBS.  BLOBS are binary large objects.  You need to be a member of
Oracle Tech Network...Here is the url for the LOBs section:

http://technet.oracle.com/doc/server.815/a68004/toc.htm

Hope this helps...

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 19, 2002 9:26 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] A good tutorial


If anyone knows of one, would someone please point me towards a good
tutorial on storing images in a database then fetching them out again.

I would really appreciate it and thanks in advance!

Jen Downey



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