[PHP-DB] Re: [PHP] PHP and Oracle
On Mon, Mar 25, 2002 at 02:49:07PM -0500, Scarbrough, Jeb (ISS Atlanta) wrote: Is it possible to create a transaction the involves multiple pages using PHP and oracle. For example, can I log onto oracle using OCIPLogon on one page named master, insert information, go to the next page named detail, insert information and commit both transactions at the same time? Try using sessions. The easies way is to save your sqls in a array that is session variable and run these sqls on the second page. Regards, Andrey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] variation on(Speed Up Code?)
Hi all, One of the pages in my site takes up to 10 seconds to display (depending on number of records (30 records takes 10 secs). The cause of the problem is the amount of information I am displaying for each record. I do multiple queries for each record to find out different things such as its position in the workflow, its price, etc. None of these are stored in the db, but are calculated on the fly depending on the data held. Apart from storing the result in the db can anyone point me in the direction of some efficient handling routines? Code is available if anyone wants bloat-mail! MTIA George in Edinburgh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] variation on(Speed Up Code?)
Do some profiling. Use PEAR's Timer class or just add here and there some echo microtime(). Find where is spent most of the time. If it is in the queries than look at your db and find out whether you missed to add some index. If indexes are ok, try to make joined queries (for mysql - LEFT JOIN (RIGHT JOIN) is probably the best choice escpecially if you have very big tables). Regards, Andrey Hristov - Original Message - From: George Pitcher [EMAIL PROTECTED] To: [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED] Sent: Tuesday, March 26, 2002 10:49 AM Subject: [PHP-DB] variation on(Speed Up Code?) Hi all, One of the pages in my site takes up to 10 seconds to display (depending on number of records (30 records takes 10 secs). The cause of the problem is the amount of information I am displaying for each record. I do multiple queries for each record to find out different things such as its position in the workflow, its price, etc. None of these are stored in the db, but are calculated on the fly depending on the data held. Apart from storing the result in the db can anyone point me in the direction of some efficient handling routines? Code is available if anyone wants bloat-mail! MTIA George in Edinburgh -- 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-DB] Re: If else Question
Maybe I am missing something but it seems you are doing things in a potentially unreliable way. Firstly... your sql statement in create.php $query_update = INSERT INTO pets (uid) SELECT uid FROM users WHERE uid={$session[uid]}; could simply be mysql_query(INSERT INTO pets SET uid = . $session[uid]); if you are using php4 session variables, why don't you use $uid as the session, so you would only need -- mysql_query(INSERT INTO pets SET uid = $ID); Moving on... I don't know why you would create an empty record, and insert data later if it is allowed. Do this: Show Form -- Submit Form -- Check Data Integrity -- Check If Allowed to Insert Record -- Insert Record If anything stuffs up then you don't do the bit following. So it doesn't check data integrity if you haven't submitted the form (obvious) and it doesn't insert the record until it checks the data integrity and if they are allowed to insert the record. Adam. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mssql cursor fetching
Is it possible to fetch the scroll cursor from microsoft sql server 2000 to the PHP installed at Linux box? I tried even enclosing the cursor to the stored procedure with no effect. My setup is: apache 1.3.19, mod_php 4.0.6, freetds 0.53 without configuration, glibc 2.2.4, kernel 2.4.17 Thanks a lot. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ODBC and images
Hi, I'm working with PHP and ODBC to get images stored in a database (Blob fields). But I experiment little problems to display these pics. Has anyone any information about PHP/ODBC/images ? Thanks, Bilbo
[PHP-DB] Re: Mssql trusted connections ?
On Mon, 11 Mar 2002 13:36:33 +1100, Terry Kearns [EMAIL PROTECTED] wrote: How does one use trusted connections with mssql_connect() ? Also, the manual says something about an interfaces file. Where do I find this? Where is this interfaces file documented? seems like 'interfaces' mentioned is the Sybase libraries configuration file -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP/Access problem
Hi, I'm working on a small Access 2000-based project and I'm getting a SQL Error . This is the query (built in PHP): SELECT * FROM 'Documents'WHERE (CourseRef='4712' AND Valid_From=#26/03/2002# AND Valid_Until=#26/03/2002#) Order by Author,Title Any clues or pointers? George -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] procedures?
I suggest subscribing to the mysql mailing list and asking the question. [EMAIL PROTECTED] -Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 7:47 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] procedures? Hi there, Where can I find information in PLAIN terms about how to use procedures in MySQL? More importantly I want to be able to write my own so I don't have to keep re-using the same code in the way that I do now to access, delete etc from db's. Thank you :-) Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: ODBC and images
Although this article is more geared towards MySQL, the principles should apply to ODBC, and you should be able to translate the MySQL functions to ODBC functions rather easily. http://www.phpbuilder.com/columns/florian19991014.php3 David Juras wrote: Hi, I'm working with PHP and ODBC to get images stored in a database (Blob fields). But I experiment little problems to display these pics. Has anyone any information about PHP/ODBC/images ? Thanks, Bilbo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: ODBC and images
Bilbo, Also, if you could provide your code that might help. I'd guess you are having some problem with the data types and your driver as well; that info would be helpful to assist. Best regards, Andrew Hill Director of Technology Evangelism http://www.openlinksw.com/virtuoso/whatis.htm OpenLink Virtuoso Internet Data Integration Server -Original Message- From: Bruce S. Garlock [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 9:16 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: ODBC and images Although this article is more geared towards MySQL, the principles should apply to ODBC, and you should be able to translate the MySQL functions to ODBC functions rather easily. http://www.phpbuilder.com/columns/florian19991014.php3 David Juras wrote: Hi, I'm working with PHP and ODBC to get images stored in a database (Blob fields). But I experiment little problems to display these pics. Has anyone any information about PHP/ODBC/images ? Thanks, Bilbo -- 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-DB] Build problem oci8
I have a problem building php with oci8. My environment: AIX 4.3 / PHP 4.1.2 / Oracle 8.1.6 Using standard AIX cc compiler Building cgi version of php Configure: ./configure \ --enable-force-cgi-redirect \ --enable-discard-path \ --with-config-file-path=/usr/local/rlib \ --with-gd=/home/ccaamrg/build/gd-1.8.4 \ --with-png-dir=/home/ccaamrg/build/libpng \ --with-jpeg-dir=/home/ccaamrg/build/jpeg-6b \ --with-zlib-dir=/home/ccaamrg/build/zlib-1.1.4 \ --with-mysql=/home/ccaamrg/build/mysql \ --with-oci8=/nfs/ars-a/oracle/product/8.1.6 This works OK, and detects the correct oracle version: ... checking for Oracle-OCI8 support... yes checking Oracle Install-Dir... /nfs/ars-a/oracle/product/8.1.6 checking Oracle version... 8.1 ... but when I do the make, it bombs with: /bin/sh /nfs/s2.c1/mysql0/ccaamrg/php-4.1.2/libtool --silent --mode=link cc -I. -I/nfs/s2.c1/mysql0/ccaamrg/php-4.1.2/ -I/nfs/s2.c1/mysql0/ccaamrg/php-4.1.2/main -I/nfs/s2.c1/mysql0/ccaamrg/php-4.1.2 -I/nfs/s2.c1/mysql0/ccaamrg/php-4.1.2/Zend -I/home/ccaamrg/build/gd-1.8.4/ -I/home/ccaamrg/build/mysql/include -I/nfs/ars-a/oracle/product/8.1.6/rdbms/public -I/nfs/ars-a/oracle/product/8.1.6/rdbms/demo -I/nfs/ars-a/oracle/product/8.1.6/network/public -I/nfs/s2.c1/mysql0/ccaamrg/php-4.1.2/ext/xml/expat -I/nfs/s2.c1/mysql0/ccaamrg/php-4.1.2/TSRM -g -o php -export-dynamic stub.lo libphp4.la ld: 0711-317 ERROR: Undefined symbol: .alloca ld: 0711-317 ERROR: Undefined symbol: .OCIDescriptorAlloc ld: 0711-317 ERROR: Undefined symbol: .OCIEnvInit ld: 0711-317 ERROR: Undefined symbol: .OCIHandleAlloc ld: 0711-317 ERROR: Undefined symbol: .OCICollTrim ld: 0711-317 ERROR: Undefined symbol: .OCICollMax ld: 0711-317 ERROR: Undefined symbol: .OCICollSize ld: 0711-317 ERROR: Undefined symbol: .OCICollAssign ld: 0711-317 ERROR: Undefined symbol: .OCIDateFromText ld: 0711-317 ERROR: Undefined symbol: .OCICollAssignElem ld: 0711-317 ERROR: Undefined symbol: .OCIStringAssignText ... All these symbols are exported by libclntsh.a , the oracle supplied shared library which is present in the configured oracle tree. Now, I'm OK with make, but libtool is a bit of a mystery to me. I would be very grateful if anyone out there can give me some hints to make this work. Please copy your replies to my email. -- Mike Gahan Education and Information Support Division University College London http://www.ucl.ac.uk/~ccaamrg/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ANN :: QuB :: DHTML/PHP Visual Query Builder Released
InterAKT released the 1.0 version of QuB, the visual query builder for Ultradev (with PHAkt or ImpAKT). QuB is also available as a PHP/DHTML standalone version. QuB is an DHTML Query Builder designed to improve the way web developers create and use queries when creating dynamic PHP websites. This goal is reached by including some important features: - centralizing the SQL queries in a single repository - providing a graphical interface for editing queries - allowing instant result of the query in an intuitive manner QuB functionalities are very similar with Microsoft Access Query Builder ones, because we have created QuB to allow Access developers to easily upgrade from Access to a real database server as MySQL or PostgreSQL are. In the same time, QuB requires no advanced SQL knowledge, allowing even non-expert programmers to create complex queries. QuB is also tightly integrated with Ultradev, with an extension that allows Ultradev developers to use QuB recordsets in their PHP pages. The QuB Recordset is a new Recordset type designed to fully use the QuB potential from Ultradev, allowing Visual Recordset Editing. QuB has support for MySQL, Access and PostgreSQL databases. For more details on QuB, visit: http://www.interakt.ro/products/QuB/ QuB documentation can be found at: http://www.interakt.ro/products/documentation.php?prodId=11 A Flash demo of QuB can be viewed at http://www.interakt.ro/products/Demos/QUB.php The InterAKT Team -- --- Alexandru COSTIN Product Manager http://www.interakt.ro/ +401 411 2610 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Newbie? - help inserting into firebird1.0
hi. i'm running: php4, firebird 1.0, and IIS all on win2k. i'm just getting started with php and firebird, so please forgive me if the error is obvious. i hunted around for examples, the best of which i've found btw is at http://www.ibphoenix.com/ibp_howto1.html - thought i did this right, i have no trouble selecting from the database but inserting is giving me some grief... my table: RECREATE TABLE BUGS ( BUG_ID INTEGER NOT NULL, APP VARCHAR(25) CHARACTER SET NONE COLLATE NONE, APP_VERSION DECIMAL( 3, 2), BUILD VARCHAR( 5) CHARACTER SET NONE COLLATE NONE, OS VARCHAR(25) CHARACTER SET NONE COLLATE NONE, SEVERITY VARCHAR(25) CHARACTER SET NONE COLLATE NONE, BUG_PRIORITY VARCHAR( 5) CHARACTER SET NONE COLLATE NONE, BUG_STATE VARCHAR(10) CHARACTER SET NONE COLLATE NONE, SB_USER VARCHAR(25) CHARACTER SET NONE COLLATE NONE, STEPS VARCHAR( 500) CHARACTER SET NONE COLLATE NONE, EXPECTED VARCHAR( 500) CHARACTER SET NONE COLLATE NONE, OBSERVED VARCHAR( 500) CHARACTER SET NONE COLLATE NONE, OPENED DATE, CLOSED DATE, HYPOTHESIS VARCHAR( 500) CHARACTER SET NONE COLLATE NONE, SOLUTION VARCHAR( 500) CHARACTER SET NONE COLLATE NONE, STATUS VARCHAR(15) CHARACTER SET NONE COLLATE NONE ) and then the add_issue.php ? $conn=ibase_connect (ipaddress:c:\\Firebird\\data\\slugBug.gdb, SYSDBA, ); if (!$conn) { echo Acess Denied!br; exit; } $query=insert into BUGS (APP, APP_VERSION, BUILD, OS, SEVERITY, BUG_PRIORITY, BUG_STATE, SB_USER, STEPS, EXPECTED, OBSERVED, STATUS, OPENED) values ($txtApp,$numVersion,$txtBuild,$txtOs, $frmSeverity, $numPriority, $txtState, $txtUser, $txtSteps, $txtExpected, $txtObserved, $frmStatus, NOW);; $result=ibase_query($conn,$query); if (!$result) { echo Error. Can't insert the record with the query: $query! $back; exit; } echo Record saved. $back; ibase_close($conn); ? finally, the error message: Warning: InterBase: Dynamic SQL Error SQL error code = -104 Token unknown - line 3, char 47 , in C:\Inetpub\dev_root\slugbug\issue_send2.php on line 18 Error. Can't insert the record with the query: insert into BUGS (APP, APP_VERSION, BUILD, OS, SEVERITY, BUG_PRIORITY, BUG_STATE, SB_USER, STEPS, EXPECTED, OBSERVED, STATUS, OPENED) values (games/software,1.0,rc1,win2000, , 5, , jds, [PHP-DB][PHP-DB][PHP-DB][PHP-DB], [PHP-DB][PHP-DB][PHP-DB][PHP-DB], [PHP-DB][PHP-DB][PHP-DB][PHP-DB][PHP-DB][PHP-DB][PHP-DB]', , NOW);! ---do i need to do some string conversion here? or the INSERT statement wrong? a combination of the two? i'm currently RingTFM, but any help would be greatly appreciated. TIA! jon-david -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBC -- Setting ApplicationID
I think that work-around may work for me. Since I can declare a different environment variable for the PHP script, with a new alias, that should work fine. Thanks for the suggestion. - Bruce Andrew Hill wrote: Bruce, It looks like you were on the right track initially, the problem is that PHP has a major bug - odbc_setoption is coded specific to ODBC statement handle (connection id), which means that trying to use odbc_setoption the way you want attempts to set a SQLSetConnectOption AFTER the connection is open - which is bogus and will give you ODBC function sequence errors. On the other hand, the error message you were getting is a bit misleading; we are fixing that now. So... you can unfortunately not do this via Application ID, but since you are using the OpenLink Rules Book, you can still affect Session-based connection management with any of the other connection criteria: Here is one way to do it: -- Setup your session attributes by configuring the Session Rules Book Aliases section of the Multi-Tier OpenLink Admin Assistant. (http://servername:8000). You can configure session rules for any combination of Domain, Database, User, Operating System, Client Machine, Client Application, etc., and can control any connection options at the server side based on the session. Using Database as an example, add a Database Alias with a new database name and configure a session mapping rule to point to the original database name, but change the connection attributes from Read / Write to Read Only in the options for the connection session. On the PHP side, simply choose between two DSN's in the odbc.ini - one is the normal DSN, with default settings, and one will have an alternate database name, name_readonly or somesuch, that will cause the oplrqb to instantiate the appropriate connection attributes. If you run into problems, you should probably open a support case at http://www.openlinksw.com/support/suppindx.htm, as this is getting somewhat off-topic for PHP. Hope this helps! Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers I was thinking of using the usernames, but as people come and go, that might mean messing around with the oplrqb.ini file too much. I'd really like to do this based on application. What variable do I pass with the PHP script? ( I'm not sure what you mean ). Can I use a variable in PHP that passes the application name to the server? Thanks, Bruce Andrew Hill wrote: Hi Bruce, The setoption error is being thrown because you cannot use SQLSetConnectOption that way. Passing arbitrary info to be used by your application isn't really what this is for, but instead can be used to modify parameters in the ODBC API. This means you can modify things like SQL_ACCESS_MODE, SQL_AUTOCOMMIT, SQL_ODBC_CURSORS, etc., (check the 2.x spec - there are several metadata items that you can control with this API call.) I'd recommend you just pass a variable to your PHP script, and perhaps change the username to a read-only/read-write user with a case statement or somesuch, based on the application. Again, I'd strongly recommend you upgrade the OpenLink UDA version as well; 1.5 is something like 5 years old or more. Best regards, Andrew Hill Director of Technology Evangelism http://www.openlinksw.com/virtuoso/whatis.htm OpenLink Virtuoso Internet Data Integration Server -Original Message- From: Bruce S. Garlock [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 10:48 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] ODBC -- Setting ApplicationID Sure, I'm simply trying to have PHP pass an ApplicationID to the ODBC server. When a PHP script access the ODBC database, it does not set the application: 10:46:04 connectopts= user=webuser opsys=unix machine=linux application= As you can see, application= is NULL. I would like the script to pass something, so that my mapping rules on the server would allow write access to the db, if the PHP application sends a certain name. Currently our Win32 applications, like MS Access, send application names. e.g. Access, sends: application=MSACCESS. Thanks for your help, Bruce Andrew Hill wrote: Bruce, I'm not sure what you are trying to do - could you clarify? You may be able to simply use the OpenLink Rules Book to set role-based authentication on domain, ip, application, etc. Also, the ODBC Driver version (1.5) you are using is _very_ old and unsupported. I suggest you upgrade to 4.2 Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers
[PHP-DB] Re: Newbie? - help inserting into firebird1.0
Hi Jon-David, not sure that this is the only problem, but rewrite your query like this (single quotes araound the values): $query=insert into BUGS (APP, APP_VERSION, BUILD, OS, SEVERITY, BUG_PRIORITY, BUG_STATE, SB_USER, STEPS, EXPECTED, OBSERVED, STATUS, OPENED) values ('$txtApp','$numVersion','$txtBuild','$txtOs', '$frmSeverity', '$numPriority', '$txtState', '$txtUser', '$txtSteps', '$txtExpected', '$txtObserved', '$frmStatus', 'NOW');; Lutz [EMAIL PROTECTED] (Jon-David Schlough) writes: $query=insert into BUGS (APP, APP_VERSION, BUILD, OS, SEVERITY, BUG_PRIORITY, BUG_STATE,SB_USER, STEPS, EXPECTED, OBSERVED, STATUS, OPENED) values ($txtApp,$numVersion,$txtBuild,$txtOs, $frmSeverity, $numPriority, $txtState, $txtUser, $txtSteps, $txtExpected, $txtObserved, $frmStatus, NOW);; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Newbie? - help inserting into firebird1.0
you're right Lutz, that is not my only problem- turns out this statement is wrought with errors :| i should not have been referring to those values as variables...stupid lamer mistake, just the name works...also, changed the double quotes to single quotes, per Lutz's suggestion, and that worked as well...so i'm getting closer. now it tosses: Warning: InterBase: conversion error from string numVersion in C:\Inetpub\dev_root\slugbug\issue_send4.php on line 19 Error. Can't insert the record with the query: insert into BUGS (APP, APP_VERSION, BUILD, OS, SEVERITY, BUG_PRIORITY, BUG_STATE, SB_USER, STEPS, EXPECTED, OBSERVED, STATUS, OPENED) values ( 'txtApp','numVersion','txtBuild','txtOs', 'frmSeverity', 'numPriority', 'txtState', 'txtUser', 'txtSteps', 'txtExpected', 'txtObserved', 'frmStatus', 'NOW')! so this is the string conversion problem i knew was there, but hadn't gotten far enough to discover. currently RingTFM... as per usual, all help is greatly appreciated. cheers, jon-david -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Lutz Bruckner Sent: Tuesday, March 26, 2002 1:34 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Newbie? - help inserting into firebird1.0 Hi Jon-David, not sure that this is the only problem, but rewrite your query like this (single quotes araound the values): $query=insert into BUGS (APP, APP_VERSION, BUILD, OS, SEVERITY, BUG_PRIORITY, BUG_STATE, SB_USER, STEPS, EXPECTED, OBSERVED, STATUS, OPENED) values ('$txtApp','$numVersion','$txtBuild','$txtOs', '$frmSeverity', '$numPriority', '$txtState', '$txtUser', '$txtSteps', '$txtExpected', '$txtObserved', '$frmStatus', 'NOW');; Lutz [EMAIL PROTECTED] (Jon-David Schlough) writes: $query=insert into BUGS (APP, APP_VERSION, BUILD, OS, SEVERITY, BUG_PRIORITY, BUG_STATE,SB_USER, STEPS, EXPECTED, OBSERVED, STATUS, OPENED) values ($txtApp,$numVersion,$txtBuild,$txtOs, $frmSeverity, $numPriority, $txtState, $txtUser, $txtSteps, $txtExpected, $txtObserved, $frmStatus, NOW);; -- 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] Re: Newbie? - help inserting into firebird1.0
if APP_VERSION is defined as decimal you can not insert a string. So leaving away the quotes around $numVersion should bring you closer. Lutz [EMAIL PROTECTED] (Jon-David Schlough) writes: you're right Lutz, that is not my only problem- turns out this statement is wrought with errors :| i should not have been referring to those values as variables...stupid lamer mistake, just the name works...also, changed the double quotes to single quotes, per Lutz's suggestion, and that worked as well...so i'm getting closer. now it tosses: Warning: InterBase: conversion error from string numVersion in C:\Inetpub\dev_root\slugbug\issue_send4.php on line 19 Error. Can't insert the record with the query: insert into BUGS (APP, APP_VERSION, BUILD, OS, SEVERITY, BUG_PRIORITY, BUG_STATE, SB_USER, STEPS, EXPECTED, OBSERVED, STATUS, OPENED) values ( 'txtApp','numVersion','txtBuild','txtOs', 'frmSeverity', 'numPriority', 'txtState', 'txtUser', 'txtSteps', 'txtExpected', 'txtObserved', 'frmStatus', 'NOW')! so this is the string conversion problem i knew was there, but hadn't gotten far enough to discover. currently RingTFM... as per usual, all help is greatly appreciated. cheers, jon-david -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP/Access problem
SELECT * FROM 'Documents'WHERE (CourseRef='4712' AND Valid_From=#26/03/2002# AND Valid_Until=#26/03/2002#) Order by Author,Title should be SELECT * FROM Documents WHERE (CourseRef='4712' AND Valid_From=#26/03/2002# AND Valid_Until=#26/03/2002#) Order by Author,Title your table name should not hae single quotes around it... adam
[PHP-DB] how to get consistent UTC from gmmktime (w/o dst-offset) ????
hi. i'm storing events in a mysql-db, using epoch timestamps to pinpoint the exact date/time for an event. so far, I have been using localtime, being aware that there are inconsistencies in the number of epoch-seconds, when DST flips on and off. nevertheless, that works fine as long as you stick to mktime() and date() for all the date-math as in mktime(0,0,0,$month,$day+$offset,$year) but as soon as you leave php and have to do some calculation in javascript, you will encounter functions that behave differently on the pc and mac platforms. so you have to revert back to the 'add 86400-seconds' to calculate the next day. so I thought it would be nice to have all the timestamps as linear, non-dst-epoch-seconds (UTC) and I went into the gmmktime() and gmdate() functions, assuming they would do the math in a linear second-based timespace (in GMT, without DST). That seems to be the case for the output of 'gmdate', that remains correct, if you count up seconds across the DST boundary (see second example). but it seems that there is no way to calculate the gmt-epoch for a given date using gmmktime without having to add/subtract the TZ manually. gmmktime will always take your local DST-settings into calculation and upon conversion back with gmdate, you will be off by the number of hours of your timezone. I thought gmmktime() would handle this as if the computer would be in Greenwich (TZ=0), which would then leave us with the two functions encoding/decoding consistently. anyone having solved this properly? - print count days:br\n; for($day=0; $day7; $day++){ $timgmt = gmmktime(0,0,0,3,28+$day,2002); $timloc = mktime(0,0,0,3,28+$day,2002); print $timgmt . = gmmktim epoch - . gmdate(D d.m.Y H:i I,$timgmt) . br\n; print $timloc . = mktim epoch - . date(D d.m.Y H:i I,$timloc) . br\n; print BR\n; } count days: 101727= gmmktim epoch - Wed 27.03.2002 23:00 0 101727= mktim epoch - Thu 28.03.2002 00:00 0 1017356400= gmmktim epoch - Thu 28.03.2002 23:00 0 1017356400= mktim epoch - Fri 29.03.2002 00:00 0 1017442800= gmmktim epoch - Fri 29.03.2002 23:00 0 1017442800= mktim epoch - Sat 30.03.2002 00:00 0 1017529200= gmmktim epoch - Sat 30.03.2002 23:00 0 1017529200= mktim epoch - Sun 31.03.2002 00:00 0 dst on 1017619200= gmmktim epoch - Mon 01.04.2002 00:00 0 off by one hour due to DST 1017612000= mktim epoch - Mon 01.04.2002 00:00 1 1017705600= gmmktim epoch - Tue 02.04.2002 00:00 0 1017698400= mktim epoch - Tue 02.04.2002 00:00 1 1017792000= gmmktim epoch - Wed 03.04.2002 00:00 0 1017784800= mktim epoch - Wed 03.04.2002 00:00 1 - print count seconds:br\n; $baseepoch = $timloc = mktime(0,0,0,3,28,2002); for($day=0; $day7; $day++){ $epochnow = $baseepoch + (60 * 60 * 24 * $day); print $epochnow . = gmmktim epoch - . gmdate(D d.m.Y H:i I,$epochnow) . br\n; print $epochnow . = mktim epoch - . date(D d.m.Y H:i I,$epochnow) . br\n; print BR\n; } count seconds: 101727= gmmktim epoch - Wed 27.03.2002 23:00 0 consistent, but off by -1 (your TZ) 101727= mktim epoch - Thu 28.03.2002 00:00 0 1017356400= gmmktim epoch - Thu 28.03.2002 23:00 0 1017356400= mktim epoch - Fri 29.03.2002 00:00 0 1017442800= gmmktim epoch - Fri 29.03.2002 23:00 0 1017442800= mktim epoch - Sat 30.03.2002 00:00 0 1017529200= gmmktim epoch - Sat 30.03.2002 23:00 0 1017529200= mktim epoch - Sun 31.03.2002 00:00 0 1017615600= gmmktim epoch - Sun 31.03.2002 23:00 0 1017615600= mktim epoch - Mon 01.04.2002 01:00 1 1017702000= gmmktim epoch - Mon 01.04.2002 23:00 0 1017702000= mktim epoch - Tue 02.04.2002 01:00 1 1017788400= gmmktim epoch - Tue 02.04.2002 23:00 0 1017788400= mktim epoch - Wed 03.04.2002 01:00 1 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how to get consistent UTC from gmmktime (w/o dst-offset) ????
BTW for all who are following this, Patrick has cleverly illustrated that most of the northern hemisphere locations where summer time is observed will 'spring forward' this weekend. Most of the southern hemisphere locations that were in summer time did their 'fall back' last weekend! NB the two uses of the word most! Hi Patrick, References from the manual: - gmmktime -- Get UNIX timestamp for a GMT date - gmdate -- Format a GMT/CUT date/time Identical to the date() function except that the time returned is Greenwich Mean Time (GMT). For example, when run in Finland (GMT +0200), the first line below prints Jan 01 1998 00:00:00, while the second prints Dec 31 1997 22:00:00. echo date (M d Y H:i:s, mktime (0,0,0,1,1,1998)); echo gmdate (M d Y H:i:s, mktime (0,0,0,1,1,1998)); - The definition of the Unix Epoch is itself in GMT (and adjusted from there to local time using the +/-TZ difference): the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). When playing around with UNIX epoch seconds it is important to keep them time-zone separated. So try working your test backwards and putting in a data/time and then asking for the GMT and the local timestamp values. They will also be separated by the one hour/two hours. Question answered, or in my haste to get to my dinner...? Regards, =dn i'm storing events in a mysql-db, using epoch timestamps to pinpoint the exact date/time for an event. so far, I have been using localtime, being aware that there are inconsistencies in the number of epoch-seconds, when DST flips on and off. nevertheless, that works fine as long as you stick to mktime() and date() for all the date-math as in mktime(0,0,0,$month,$day+$offset,$year) but as soon as you leave php and have to do some calculation in javascript, you will encounter functions that behave differently on the pc and mac platforms. so you have to revert back to the 'add 86400-seconds' to calculate the next day. so I thought it would be nice to have all the timestamps as linear, non-dst-epoch-seconds (UTC) and I went into the gmmktime() and gmdate() functions, assuming they would do the math in a linear second-based timespace (in GMT, without DST). That seems to be the case for the output of 'gmdate', that remains correct, if you count up seconds across the DST boundary (see second example). but it seems that there is no way to calculate the gmt-epoch for a given date using gmmktime without having to add/subtract the TZ manually. gmmktime will always take your local DST-settings into calculation and upon conversion back with gmdate, you will be off by the number of hours of your timezone. I thought gmmktime() would handle this as if the computer would be in Greenwich (TZ=0), which would then leave us with the two functions encoding/decoding consistently. anyone having solved this properly? - print count days:br\n; for($day=0; $day7; $day++){ $timgmt = gmmktime(0,0,0,3,28+$day,2002); $timloc = mktime(0,0,0,3,28+$day,2002); print $timgmt . = gmmktim epoch - . gmdate(D d.m.Y H:i I,$timgmt) . br\n; print $timloc . = mktim epoch - . date(D d.m.Y H:i I,$timloc) . br\n; print BR\n; } count days: 101727= gmmktim epoch - Wed 27.03.2002 23:00 0 101727= mktim epoch - Thu 28.03.2002 00:00 0 1017356400= gmmktim epoch - Thu 28.03.2002 23:00 0 1017356400= mktim epoch - Fri 29.03.2002 00:00 0 1017442800= gmmktim epoch - Fri 29.03.2002 23:00 0 1017442800= mktim epoch - Sat 30.03.2002 00:00 0 1017529200= gmmktim epoch - Sat 30.03.2002 23:00 0 1017529200= mktim epoch - Sun 31.03.2002 00:00 0 dst on 1017619200= gmmktim epoch - Mon 01.04.2002 00:00 0 off by one hour due to DST 1017612000= mktim epoch - Mon 01.04.2002 00:00 1 1017705600= gmmktim epoch - Tue 02.04.2002 00:00 0 1017698400= mktim epoch - Tue 02.04.2002 00:00 1 1017792000= gmmktim epoch - Wed 03.04.2002 00:00 0 1017784800= mktim epoch - Wed 03.04.2002 00:00 1 - print count seconds:br\n; $baseepoch = $timloc = mktime(0,0,0,3,28,2002); for($day=0; $day7; $day++){ $epochnow = $baseepoch + (60 * 60 * 24 * $day); print $epochnow . = gmmktim epoch - . gmdate(D d.m.Y H:i I,$epochnow) . br\n; print $epochnow . = mktim epoch - . date(D d.m.Y H:i I,$epochnow) . br\n; print BR\n; } count seconds: 101727= gmmktim epoch - Wed 27.03.2002 23:00 0 consistent, but off by -1 (your TZ) 101727= mktim epoch - Thu 28.03.2002 00:00 0 1017356400= gmmktim epoch - Thu 28.03.2002 23:00 0 1017356400= mktim epoch - Fri 29.03.2002 00:00 0 1017442800= gmmktim epoch - Fri 29.03.2002 23:00 0 1017442800= mktim epoch - Sat 30.03.2002 00:00 0 1017529200= gmmktim epoch - Sat 30.03.2002 23:00 0 1017529200= mktim epoch - Sun 31.03.2002 00:00 0 1017615600= gmmktim epoch - Sun 31.03.2002 23:00 0
[PHP-DB] Contact Database php_mysql
I am contemplating a Historical Database I barely can spel redundant let alone normalize so I am handicapped. The aim is to enter a name only once. I am studying linking tables. In the [Contact] idContact First_Name,Last_Name,Middle,Suffix,Full_Name,idCity,idState,City_State,i dZip_Code, Address_1,Address_2, [City] id Cityname id (al, ar etc) Statename [ZipCode] id Zip_Code Comment please, Russell Griechen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Contact Database php_mysql
Normalization depends on how the data will be used. For instance in the contacts database you want to enter a name only once. What you have looks fine but it makes an assumption: Each address has only one contact and each contact only one address. I'm not sure why you want City, State and Zip in other tables. Granted, there are programmitic advantages to doing this, like being able to present a list of cities/states for an entered zip code. If your users will just read or data entry is not important then normalizing those values can be a pain and I think it's overkill. Note: If you want to limit the users to entering valid state codes (a list which hasn't changed in 15 years), just code that into Code Charges validation routine or use a list box with a hard coded list. Glenn Russell Griechen [EMAIL PROTECTED] wrote in message 011001c1d52f$82231140$b4601442@oemcomputer">news:011001c1d52f$82231140$b4601442@oemcomputer... I am contemplating a Historical Database I barely can spel redundant let alone normalize so I am handicapped. The aim is to enter a name only once. I am studying linking tables. In the [Contact] idContact First_Name,Last_Name,Middle,Suffix,Full_Name,idCity,idState,City_State,i dZip_Code, Address_1,Address_2, [City] id Cityname id (al, ar etc) Statename [ZipCode] id Zip_Code Comment please, Russell Griechen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] procedures?
From MySQL.com documentation: Our aim is to have stored procedures implemented in MySQL Server 4.1. I think it's in beta but not sure if that feature is implemented now. I'm using stable versions 3.x.x. Glenn Rick Emery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I suggest subscribing to the mysql mailing list and asking the question. [EMAIL PROTECTED] -Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 7:47 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] procedures? Hi there, Where can I find information in PLAIN terms about how to use procedures in MySQL? More importantly I want to be able to write my own so I don't have to keep re-using the same code in the way that I do now to access, delete etc from db's. Thank you :-) Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Contact Database php_mysql
Not so sure you need to go to that much detail in the linking of your tables. It's a good idea for the states, but the zip is usually just an integer anyway, so you can just store that with the record. Next, do you really need Full_Name??? You can extract that from the other two fields. As for city, that's going to be a HUGE table. The only advantage to making another table out of such is if you had more data per record and you need to search really fast. Just store that in with the Contact info the single table. The way I'd do it would be like this: [Contacts] ID int primary key auto_increment not null fname varchar(25) not null lname varchar(35) not null mname varchar(25) suffix varchar(5) addr1 varchar(35) addr2 varchar(35) city varchar(35) not null state int not null zip int not null [State] ID int primary key auto_increment not null state varchar(25) The field sizes are arbitrary, so think about what you're gonna need and size appropriately. Russell Griechen wrote: I am contemplating a Historical Database I barely can spel redundant let alone normalize so I am handicapped. The aim is to enter a name only once. I am studying linking tables. In the [Contact] idContact First_Name,Last_Name,Middle,Suffix,Full_Name,idCity,idState,City_State,i dZip_Code, Address_1,Address_2, [City] id Cityname id (al, ar etc) Statename [ZipCode] id Zip_Code Comment please, Russell Griechen -- 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