Re: [PHP-DB] PHP for apache logging to mysql
Hi Paul On 27 Mar,2003 at 12:44 Paul Burney wrote: snip Hope that helps. YMMV. TMTOWTDI. /snip It did !! I had tried a direct pipe, but had neglected the all important semi-colon on the insert !!! Is this reasonably efficient on your production server ? Do you have any problems with it ? Also, how are you dealing with growing table sizes ? Do you summarise out data to sub tables ? Or do you limit the date range and periodically dump stuff that is out of range ? Part of the reason for using Perl / PHP, etc was to allow the log data to be filtered and sorted prior to inserting to the db. This would then allow automatic summarising so you could maintian host tables, request tables, etc and limit the size of the main transfer log tables. My approach to the queries thus far has been to keep different 'reports' (which essentially narrow down to individual SQL queries) in a db. A user picks a report, the SQL is selected and run and the data is then displayed (also playing with JPGraph to produce some nice charts). Works quite well and means that adding a new 'report' is simply a matter of adding a row in the reports table. snip Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? /snip Once again, thanks for the tips !! -- Ronan e: [EMAIL PROTECTED] t: 01903 739 997 w: www.thelittledot.com The Little Dot is a partnership of Ronan Chilvers and Giles Webberley -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] multiple queries in PHP to mysql database.
Hi Jerry Inline comments On 28 Mar,2003 at 12:31 JeRRy JeRRy wrote: How can I update 2 tables at once if a match occours from information inputed into a PHP form. How about turning this around and re-organising the data a little? Why not have a single score table with references to a central username / pw / id table. Table 1 - users id username password Table 2 - scores id userid game1 game2 game3 game4 ... overall You can then do UPDATE table2 SET game1=game1+1, overall=overall+1 WHERE userid = $userid Getting a results table would then be a single query... Does this help at all ? Hopefully I've grasped enough of the concept to not make a complete fool of myself ! Jerry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] posting variables
Hi When I use FORM ACTION=?php echo $_SERVER['PHP_SELF']; ? METHOD=POST INPUT TYPE=submit NAME=submitp VALUE=Sendp INPUT TYPE=submit NAME=submitn VALUE=Sendn to attempt to control variables in the script the variables are not kept and are refreshed every post, how can i ensure they are kept as below? { $lim1 = ($lim1 + 10); echo $lim1; echo is set; } else { echo is not set; $lim1 = ($lim1 + 20); echo $lim1; } Regards Steve Dodkins _ IMPORTANT NOTICE This email (including any attachments) is meant only for the intended recipient. It may also contain confidential and privileged information. If you are not the intended recipient, any reliance on, use, disclosure, distribution or copying of this email or attachments is strictly prohibited. This email is not intended to be relied upon by any person without subsequent written confirmation of its contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. Furthermore, the content of this e-mail is the personal view of the sender and does not represent the advice, views or opinion of our company. Accordingly, our company disclaim all responsibility and accept no liability (including in negligence) for the consequences of any person acting, or refraining from acting, on such information prior to the receipt by those persons of subsequent written confirmation. In particular (but not by way of limitation) our company disclaims all responsibility and accepts no liability for any e-mails which are defamatory, offensive, racist or in any other way are in breach of any third party's rights, including breach of confidence, privacy or other rights. If you have received this e-mail message in error, please notify me immediately by telephone. Please also destroy and delete the message from your computer. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message is strictly prohibited. If you have received this E-mail in error, or suspect that the message may have been intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245 468555. ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ
[PHP-DB] getting serial in PHP
Hi list. I have no real education in PHP or postgre, so forgive me if I dont use the correct language or expressions. I have a small problem that is probably easily solved if you just know how to do it. I have a PHP interface over a postgreSQL database, where I can search, add, delete or modify records. Now, when adding a new record, a query could look something like this: $query = insert into logs values (nextval('public.logs_log_id_seq'::text),$id,'$logtext','now','$_SERVER[PHP_AUTH_USER]');; The first value, the nextval thingie (if someone could give me the correct term for such a feature I would appriciate it) gives the added row a unique serial number. How do I figure out the serial my newly added row was assigned? What I want to do is something like 'echo Your submission was accepted and assigned log ID $log_id; ' directly below the $query line. How do I get the correct value into $log_id? Hopefully, someone understands my confused rantings and can give me directions to some documentation or maybe even the name of a variable I can use. :) TIA -- R -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem while connecting to remote MySQL(RH8.0) using PHP
Hi, I've been facing problem while trying to access remote MySQL database using PHP. It is working fine with the local database. I did in the following way: Created a user on the database with [EMAIL PROTECTED] identified by 'password'; Warning: Warning: Lost connection to MySQL server during query in /var/www/html/helpdesk/common/mysql.class.php on line 41 2013 : Lost connection to MySQL server during query System details: OS: RedHat 8.0 PHP version: 4.2.2 MySQL Version: 3.23.52 Please help me out. Thanks Regards Praveen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP / Apache -- output truncated after pg_connect() call
I'm having a problem with a php script when connecting to a postgresql database. The problem is this: When Apache runs the php script, the output is missing everything after my first call to pg_connect(). i.e., I can echo, print whatever I like, but everything is cut off after that call--it doesn't show up in the output when run by Apache However. if I pass the script through php manually, I get the expected output. For instance, here's the code: html head titlePHP Test/title /head body ?php import_request_variables('p', 'p_'); $conn_string = dbname=PilotProjects user=web-user password=secret; print p; echo Point 1; echo /p; print fubar; $database = pg_connect ($conn_string) or die (No connection to the database. Error: . pg_last_error()); echo Point1.5\n; echo p; echo pg_dbname($database); echo /p; echo get_resource_type($database); echo Point 2\n; $result=pg_query ($database, SELECT \ProjectName\ FROM \ProjectsTable\); $resultprintme = pg_fetch_row($result,0) or die (Help! no query result. Error: .pg_last_error() . \n); echo $resultprintme[0] . \n; /* foreach ($resultprintme as $ProjectName) { print ($ProjectName\n); }*/ pg_close ($database); ? /body /html When Apache runs the script through php, here's the output: html head titlePHP Test/title /head body p/pfubar However, when I run the code through php from the command line, the output is this: [EMAIL PROTECTED]:~/htdocs/tests/php$ php ./selectStudy1.php Content-type: text/html X-Powered-By: PHP/4.3.0 html head titlePHP Test/title /head body pPoint 1/pfubarPoint1.5 pPilotProjects/ppgsql linkPoint 2 Brown County /body /html Which is what I expected. Can anyone help me with this? Is this a problem with Apache? With php? With something else? Any help will be greatly appreciated! dwb === My configuration: Slackware Linux w / 2.4.18 kernel Apache: [EMAIL PROTECTED]:/etc/apache# httpd -V Server version: Apache/1.3.26 (Unix) Server built: Jun 19 2002 05:51:45 Server's Module Magic Number: 19990320:13 Server compiled with -D EAPI -D HAVE_MMAP -D HAVE_SHMGET -D USE_SHMGET_SCOREBOARD -D USE_MMAP_FILES -D HAVE_FCNTL_SERIALIZED_ACCEPT -D HAVE_SYSVSEM_SERIALIZED_ACCEPT -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D HTTPD_ROOT=/usr -D SUEXEC_BIN=/usr/sbin/suexec -D DEFAULT_PIDLOG=/var/run/httpd.pid -D DEFAULT_SCOREBOARD=/var/run/httpd.scoreboard -D DEFAULT_LOCKFILE=/var/run/httpd.lock -D DEFAULT_ERRORLOG=/var/log/apache/error_log -D TYPES_CONFIG_FILE=/etc/apache/mime.types -D SERVER_CONFIG_FILE=/etc/apache/httpd.conf -D ACCESS_CONFIG_FILE=/etc/apache/access.conf -D RESOURCE_CONFIG_FILE=/etc/apache/srm.conf php: [EMAIL PROTECTED]:/etc/apache# php -v PHP 4.3.0 (cgi), Copyright (c) 1997-2002 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies David W. Brunberg Engineering Supervisor - Field Process The F.B. Leopold Company, Inc. 227 South Division Street Zelienople PA 16063 (724) 452-6300 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Connection issues with pgsql?
Hi, I just installed PHP with pgsql support, and it doesn't seem to work properly, although I don't see why it shouldn't. I'm running the following script: ?php error_reporting (E_ALL); $myconn = pg_connect(dbname=thornvalley); $res = pg_query('select * from test;', $myconn); print_r(pg_fetch_row($res)); ? and this is what I get back: Warning: pg_query(): supplied argument is not a valid PostgreSQL link resource in /var/www/html/dbtest.php on line 4 Warning: pg_fetch_row(): supplied argument is not a valid PostgreSQL result resource in /var/www/html/dbtest.php on line 5 without any other clues as to what might be happening. I have tried using other connection strings as well: dbname=thornvalley user=apache password=[passwd] dbname=thornvalley user=apache password=[passwd] host=localhost port=5432 with the same result. I'm not sure what's going on; just so that you know, I'm using the RPM-based install of Apache 2.0.44, PHP 4.3.1 and PostgreSQL 7.3.2 that comes with Mandrake Linux 9.1. All of the necessary support packages (AFAIK) have been installed and are visible with phpinfo() (i.e. there's a pgsql section), and I have defined an apache user in the PostgreSQL database... so, any clues as to what might be going on? Nathaniel Price http://www.thornvalley.com Who is General Failure and why is he reading my hard drive? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Putting a string into a variable.
I am having problems putting an html string into a variable to create an array of strings. something like this: $stringarray[] = array(); $i = 0; while ( $i 6 ){ $stringarray[$i] = table cellspacing=\0\trtd.$this-differentarray[0] [0]./td/tr/table; } When I echo $stringarray[1] it comes up empty... Is there a special trick to get a string into an array or even store one as a variable. thanks, /Tim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Putting a string into a variable.
The part where $i is never equal to 1 might be the problem. You might want to try incrementing your sentinel when using loops. -Original Message- From: Info_Best-IT [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 11:13 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Putting a string into a variable. I am having problems putting an html string into a variable to create an array of strings. something like this: $stringarray[] = array(); $i = 0; while ( $i 6 ){ $stringarray[$i] = table cellspacing=\0\trtd.$this-differentarray[0] [0]./td/tr/table; } When I echo $stringarray[1] it comes up empty... Is there a special trick to get a string into an array or even store one as a variable. thanks, /Tim -- 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] Putting a string into a variable.
You might be getting an empty result because you don't have anything in $stringarray[1]. You set $i = 0 then have a while loop that does something while $i 6. But you never go through and increment $i at all so it's always equal to 0. You might get some type of result if you echoed $stringarray[0] in that case. You should use a for loop and remember to increment ($i++) the variable in the appropriate place inside the for loop. Additionally, I think the proper way to accomplish your array assignment is to state $stringarray = array(). I seem to remember reading somewhere that $stringarray[] = array() isn't quite correct. It works, but it's not correct. It's Friday, it's nice outside and I'm not concentrating much, so I hope this information is of some help. Good luck, Rich -Original Message- From: Info_Best-IT [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 2:13 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Putting a string into a variable. I am having problems putting an html string into a variable to create an array of strings. something like this: $stringarray[] = array(); $i = 0; while ( $i 6 ){ $stringarray[$i] = table cellspacing=\0\trtd.$this-differentarray[0] [0]./td/tr/table; } When I echo $stringarray[1] it comes up empty... Is there a special trick to get a string into an array or even store one as a variable. thanks, /Tim -- 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] Putting a string into a variable.
I found what I remembered reading. If you're curious, go here: http://www.php.net/manual/en/language.types.array.php and scroll down to the Array Do's and Don'ts section. Don't know if it actually does pertain to what you're doing, but it IS what I was thinking of. -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 2:22 PM To: 'Info_Best-IT'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Putting a string into a variable. You might be getting an empty result because you don't have anything in $stringarray[1]. You set $i = 0 then have a while loop that does something while $i 6. But you never go through and increment $i at all so it's always equal to 0. You might get some type of result if you echoed $stringarray[0] in that case. You should use a for loop and remember to increment ($i++) the variable in the appropriate place inside the for loop. Additionally, I think the proper way to accomplish your array assignment is to state $stringarray = array(). I seem to remember reading somewhere that $stringarray[] = array() isn't quite correct. It works, but it's not correct. It's Friday, it's nice outside and I'm not concentrating much, so I hope this information is of some help. Good luck, Rich -Original Message- From: Info_Best-IT [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 2:13 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Putting a string into a variable. I am having problems putting an html string into a variable to create an array of strings. something like this: $stringarray[] = array(); $i = 0; while ( $i 6 ){ $stringarray[$i] = table cellspacing=\0\trtd.$this-differentarray[0] [0]./td/tr/table; } When I echo $stringarray[1] it comes up empty... Is there a special trick to get a string into an array or even store one as a variable. thanks, /Tim -- 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Putting a string into a variable.
Hi Tim Comments inline... $stringarray[] = array(); $i = 0; while ( $i 6 ){ $stringarray[$i] = table cellspacing=\0\trtd.$this-differentarray[0] [0]./td/tr/table; } When I echo $stringarray[1] it comes up empty... Is there a special trick to get a You're not incrementing $i. You need $i++ in your while loop. thanks, /Tim -- Ronan e: [EMAIL PROTECTED] t: 01903 739 997 w: www.thelittledot.com The Little Dot is a partnership of Ronan Chilvers and Giles Webberley -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Connection issues with pgsql?
I'd suggest building a connection string, explicitly defining the user and password. Maybe it would give you a more descriptive error that way (invalid user, etc.). The other thing I've done is do something like this: $database = pg_connect ($conn_string) or die (Help! No connection to the database! Error: . pg_last_error()); That may give you some more diagnostic info? dwb -Original Message- From: Nathaniel Price [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 2:05 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Connection issues with pgsql? Hi, I just installed PHP with pgsql support, and it doesn't seem to work properly, although I don't see why it shouldn't. I'm running the following script: ?php error_reporting (E_ALL); $myconn = pg_connect(dbname=thornvalley); $res = pg_query('select * from test;', $myconn); print_r(pg_fetch_row($res)); ? and this is what I get back: Warning: pg_query(): supplied argument is not a valid PostgreSQL link resource in /var/www/html/dbtest.php on line 4 Warning: pg_fetch_row(): supplied argument is not a valid PostgreSQL result resource in /var/www/html/dbtest.php on line 5 without any other clues as to what might be happening. I have tried using other connection strings as well: dbname=thornvalley user=apache password=[passwd] dbname=thornvalley user=apache password=[passwd] host=localhost port=5432 with the same result. I'm not sure what's going on; just so that you know, I'm using the RPM-based install of Apache 2.0.44, PHP 4.3.1 and PostgreSQL 7.3.2 that comes with Mandrake Linux 9.1. All of the necessary support packages (AFAIK) have been installed and are visible with phpinfo() (i.e. there's a pgsql section), and I have defined an apache user in the PostgreSQL database... so, any clues as to what might be going on? Nathaniel Price http://www.thornvalley.com Who is General Failure and why is he reading my hard drive? -- 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] Connection issues with pgsql?
As I said in my first post, I tried the following connection strings as well: dbname=thornvalley user=apache password=[passwd] dbname=thornvalley user=apache password=[passwd] host=localhost port=5432 and had the same results. After messing around with pg_hba.conf (I set local authentication to 'password' instead of 'ident', I was able to get an error message /when I used the wrong password/: Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL: Password authentication failed for user apache . in /var/www/html/dbtest.php on line 3 error If I used the correct password, that message would not appear. Furthermore, when I added the line echo $myconn = .$myconn; to my script after pg_connect(), I would get: $myconn = Resource id #2 which suggessts to me that it is successful in connecting to the db server, but, for some reason PHP is unable to use the connection after that. Like I said, it's weird. I have no idea why it's doing that. - Original Message - From: Dave Brunberg [EMAIL PROTECTED] To: 'Nathaniel Price' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, March 28, 2003 12:24 PM Subject: RE: [PHP-DB] Connection issues with pgsql? I'd suggest building a connection string, explicitly defining the user and password. Maybe it would give you a more descriptive error that way (invalid user, etc.). The other thing I've done is do something like this: $database = pg_connect ($conn_string) or die (Help! No connection to the database! Error: . pg_last_error()); That may give you some more diagnostic info? dwb -Original Message- From: Nathaniel Price [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 2:05 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Connection issues with pgsql? [snip] I have tried using other connection strings as well: dbname=thornvalley user=apache password=[passwd] dbname=thornvalley user=apache password=[passwd] host=localhost port=5432 with the same result. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Connection issues with pgsql?
Check the documentation on pg_query. http://www.php.net/manual/en/function.pg-query.php It expects the link identifier as the first argument and the query as the second. Switch your arguments and you might have some luck. The manual is always a great place to look for answers to things like this. -Original Message- From: Nathaniel Price [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 11:05 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Connection issues with pgsql? Hi, I just installed PHP with pgsql support, and it doesn't seem to work properly, although I don't see why it shouldn't. I'm running the following script: ?php error_reporting (E_ALL); $myconn = pg_connect(dbname=thornvalley); $res = pg_query('select * from test;', $myconn); print_r(pg_fetch_row($res)); ? and this is what I get back: Warning: pg_query(): supplied argument is not a valid PostgreSQL link resource in /var/www/html/dbtest.php on line 4 Warning: pg_fetch_row(): supplied argument is not a valid PostgreSQL result resource in /var/www/html/dbtest.php on line 5 without any other clues as to what might be happening. I have tried using other connection strings as well: dbname=thornvalley user=apache password=[passwd] dbname=thornvalley user=apache password=[passwd] host=localhost port=5432 with the same result. I'm not sure what's going on; just so that you know, I'm using the RPM-based install of Apache 2.0.44, PHP 4.3.1 and PostgreSQL 7.3.2 that comes with Mandrake Linux 9.1. All of the necessary support packages (AFAIK) have been installed and are visible with phpinfo() (i.e. there's a pgsql section), and I have defined an apache user in the PostgreSQL database... so, any clues as to what might be going on? Nathaniel Price http://www.thornvalley.com Who is General Failure and why is he reading my hard drive? -- 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] Connection issues with pgsql?
Sorry for not fully reading your post. That's what I get 4 spd rdng. Just another WAG--have you tried using get_resource_type() on $myconn? That may tell you whether the thing exists after its creation, and if it does, it should tell you pgsql link as the resource type. I'd suspect that if it doesn't know the type that the postgresql interface is not enabled. Again, sorry for shooting from the hip with the first answer. dwb -Original Message- From: Nathaniel Price [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 4:23 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Connection issues with pgsql? As I said in my first post, I tried the following connection strings as well: dbname=thornvalley user=apache password=[passwd] dbname=thornvalley user=apache password=[passwd] host=localhost port=5432 and had the same results. After messing around with pg_hba.conf (I set local authentication to 'password' instead of 'ident', I was able to get an error message /when I used the wrong password/: Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL: Password authentication failed for user apache . in /var/www/html/dbtest.php on line 3 error If I used the correct password, that message would not appear. Furthermore, when I added the line echo $myconn = .$myconn; to my script after pg_connect(), I would get: $myconn = Resource id #2 which suggessts to me that it is successful in connecting to the db server, but, for some reason PHP is unable to use the connection after that. Like I said, it's weird. I have no idea why it's doing that. - Original Message - From: Dave Brunberg [EMAIL PROTECTED] To: 'Nathaniel Price' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, March 28, 2003 12:24 PM Subject: RE: [PHP-DB] Connection issues with pgsql? I'd suggest building a connection string, explicitly defining the user and password. Maybe it would give you a more descriptive error that way (invalid user, etc.). The other thing I've done is do something like this: $database = pg_connect ($conn_string) or die (Help! No connection to the database! Error: . pg_last_error()); That may give you some more diagnostic info? dwb -Original Message- From: Nathaniel Price [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 2:05 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Connection issues with pgsql? [snip] I have tried using other connection strings as well: dbname=thornvalley user=apache password=[passwd] dbname=thornvalley user=apache password=[passwd] host=localhost port=5432 with the same result. -- 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] Connection issues with pgsql?
OOPS! /me hangs head in shame... That's what it was. Guess that's what I get for always using PHPlib's abstraction layer... I hardly ever use the actual pg_*() functions anymore. Thanks for putting up with me. ;) Nathaniel Price http://www.thornvalley.com Who is General Failure and why is he reading my hard drive? - Original Message - From: Jennifer Goodie [EMAIL PROTECTED] To: Nathaniel Price [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, March 28, 2003 1:27 PM Subject: RE: [PHP-DB] Connection issues with pgsql? Check the documentation on pg_query. http://www.php.net/manual/en/function.pg-query.php It expects the link identifier as the first argument and the query as the second. Switch your arguments and you might have some luck. The manual is always a great place to look for answers to things like this. -Original Message- From: Nathaniel Price [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 11:05 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Connection issues with pgsql? Hi, I just installed PHP with pgsql support, and it doesn't seem to work properly, although I don't see why it shouldn't. I'm running the following script: ?php error_reporting (E_ALL); $myconn = pg_connect(dbname=thornvalley); $res = pg_query('select * from test;', $myconn); print_r(pg_fetch_row($res)); ? and this is what I get back: Warning: pg_query(): supplied argument is not a valid PostgreSQL link resource in /var/www/html/dbtest.php on line 4 Warning: pg_fetch_row(): supplied argument is not a valid PostgreSQL result resource in /var/www/html/dbtest.php on line 5 without any other clues as to what might be happening. I have tried using other connection strings as well: dbname=thornvalley user=apache password=[passwd] dbname=thornvalley user=apache password=[passwd] host=localhost port=5432 with the same result. I'm not sure what's going on; just so that you know, I'm using the RPM-based install of Apache 2.0.44, PHP 4.3.1 and PostgreSQL 7.3.2 that comes with Mandrake Linux 9.1. All of the necessary support packages (AFAIK) have been installed and are visible with phpinfo() (i.e. there's a pgsql section), and I have defined an apache user in the PostgreSQL database... so, any clues as to what might be going on? Nathaniel Price http://www.thornvalley.com Who is General Failure and why is he reading my hard drive? -- 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Generating view of tree?
Craig -- ...and then Craig Kohtz said... % ... % The script I've included works for a table named structure with the % following fields: Sounds interesting. Care to actually post the script? ;-) I'd like to see it. TIA HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] PHP for apache logging to mysql
on 3/28/03 7:30 AM, Ronan Chilvers at [EMAIL PROTECTED] appended the following bits to my mbox: Is this reasonably efficient on your production server ? Do you have any problems with it ? It's pretty efficient on my production server. Since I don't index the initial table, the inserts go quickly. One possible problem is that there is a MySQL process open for every apache child. We run a quad-xeon server with 1 GB of RAM so it's not an issue for us. Also, how are you dealing with growing table sizes ? Do you summarise out data to sub tables ? Or do you limit the date range and periodically dump stuff that is out of range ? Right now, I'm copying the data nightly from the live table to the archive one. MySQL tends to corrupt index files when you perform long queries (joins, grouping with conditions, etc) and other clients are trying to insert data at the same time. Without indices, the querying is pretty slow. We only keep the last month of logs in the database. The tables get huge with hundreds of thousands of records in them. We still do long term processing of standard log files with Webalizer. Part of the reason for using Perl / PHP, etc was to allow the log data to be filtered and sorted prior to inserting to the db. This would then allow automatic summarising so you could maintian host tables, request tables, etc and limit the size of the main transfer log tables. Those are good benefits. I'm sure it would be faster than working with the whole dataset. Regarding your previous post, I'd probably stick to Perl (apologies to some on this list). I know the recent CLI improvements are supposed to help a lot, but I still feel Perl plays better with the shell, especially with file IO. My approach to the queries thus far has been to keep different 'reports' (which essentially narrow down to individual SQL queries) in a db. A user picks a report, the SQL is selected and run and the data is then displayed (also playing with JPGraph to produce some nice charts). Cool. We'd love to see some of your results when they are usable. Sincerely, Paul Burney http://paulburney.com/ ?php // the statement formerly known as prince if ($the_elevator == 'tries to bring you down') { go_crazy('punch a higher floor'); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Sybase / HPUX (Urgent HELP -- PLEASE.)
Folks, I am trying to connect to a sybase server (12.5) using PEAR DB object. When connecting to the database from Linux, everything goes as expected. However, when running on HPUX (Apache 1.3.27/PHP 4.3.1 DSO), I get the following error: php_code: $this-$db = @DB::connect(sybase://$DB_USR:[EMAIL PROTECTED]/); if(DB::iserror($this-$db)) { var_dump($this-$db); die('Error connecting to databse: '.$this-$db-getMessa ge()); } } == Prin out === object(db_error)(7) { [error_message_prefix]= string(0) [mode]= int(1) [level]= int(1024) [code]= int(-24) [message]= string(24) DB Error: connect failed [userinfo]= string(31) sybase://arc:[EMAIL PROTECTED]/ [callback]= NULL } Error connecting to databse: DB Error: connect failed The interfaces file that I am using is EXACTLY the same as the one on the linux machine and it on the sybases standart place on HP. I could not find anything on apache/php/sybase logs. PLEASE HELP... Thanks in advance.. __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySql, PHP, and Dates
I'm experienced with SQL, but new to MySql and PHP, which I'm using together to create a dynamic web site. Right now, I'm having minor difficulties with date formatting. It seems that when I retrieve a date from MySQL into PHP, it shows up as a string instead of a date data type, with format -MM-DD HH:MM:SS. Is there any way that I can get it returned as a PHP date instead? Also, exactly what is it that controls the output format of the date as a string? Is PHP somehow requesting that MySql return the date as a string, or is it getting a date from MySql and then converting it to a string on the PHP side? What's the best way of controlling date format? Obviously, I could use string operators to extract the year, month, and day and do whatever I want to with them, but that's sensitive to how PHP and/or MySql are configured, I assume; it would be better for me to request the date in a specific form (ideally one taken from operating system preferences). Thanks! Bruce Feist -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysqld ending at start up
The mysql support list is slow, so I though I would post here since I know this list is more active. MySQL shuts down when I start it up... Starting mysqld daemon with databases from/home/mysqldb 030328 09:29:32 mysqld ended __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] mysqld ending at start up
The mysql support list is slow, so I though I would post here since I know this list is more active. MySQL shuts down when I start it up... Starting mysqld daemon with databases from/home/mysqldb 030328 09:29:32 mysqld ended Usually means you have an error in your my.cnf file. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] mysqld ending at start up
Usually means you have an error in your my.cnf file. Is the my.cnf file a new thing with mysql because I heard about it for the first time today? Is there a way to configtest the my.cnf file like there is with apache? Thanks, J __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySql, PHP, and Dates
I'm experienced with SQL, but new to MySql and PHP, which I'm using together to create a dynamic web site. Right now, I'm having minor difficulties with date formatting. It seems that when I retrieve a date from MySQL into PHP, it shows up as a string instead of a date data type, with format -MM-DD HH:MM:SS. Is there any way that I can get it returned as a PHP date instead? Also, exactly what is it that controls the output format of the date as a string? Is PHP somehow requesting that MySql return the date as a string, or is it getting a date from MySql and then converting it to a string on the PHP side? What's the best way of controlling date format? Obviously, I could use string operators to extract the year, month, and day and do whatever I want to with them, but that's sensitive to how PHP and/or MySql are configured, I assume; it would be better for me to request the date in a specific form (ideally one taken from operating system preferences). A couple different ways you can handle this. To format the timestamp from -MM-DD HH:MM:SS to something else, you can use the DATE_FORMAT() function within your SQL. It works almost exactly like the date() function in PHP. If you want to get the output from MySQL as an integer, you can use SELECT column+0 which will return the timestamp in a MMDDHHMMSS format. If you want a Unix timestamp, which is compatible with the date() function in PHP, then use the UNIX_TIMESTAMP() function in your SQL. You could also use the strtotime() function in PHP to take the MySQL timestamp and convert it to a Unix timestamp. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php