[PHP-DB] Php mariadb unique field selection for index of query result.
Hi, Quick question. I may be missing something but for years I've been processing the output of a query into a new array using the unique(normally primary key) field in the table as the index so I can pull data matches simply further into the script without another loop through all the returned data. Is there an option I'm missing to assign a field as the output array index from a PHP based query? Thanks, -- Richard Scotford
Re: [PHP-DB] PHP mysqli is NOT trapping some errors when calling stored procedure
Yes, I do have all reqd privs. In fact, as long as a duplicate key situation isnt encountered, I am able to invoke the stored proc from PHP alright and the record gets saved in the database. But when I try to re-do it using the same value (thereby I am expecting that 1062-DUPLICATE KEY error will be thrown and caught by PHP), I dont get any error from PHP! In mysql client or MySQL Workbench, I do see the error. when I invoke the stored proc. Thanks, Venkat On Tue, Feb 12, 2019 at 9:56 PM Aziz Saleh wrote: > Do you have sufficient privileges to execute stored procedures > (procs_priv) on PHP's end? > > On Tue, Feb 12, 2019 at 11:07 AM Venkat Hariharan > wrote: > >> Can you take a look at the issue that I've described at >> >> https://stackoverflow.com/questions/54643704/php-mysqli-is-not-trapping-some-errors-when-calling-stored-procedure >> and tell me what I am missing in my PHP code ? >> >> To summarize: I am calling a MySQL stored procedure from PHP that does >> some >> DMLs (using mysqli). But the problem is that PHP is not able to get >> intimated of some database error conditions raised by the stored proc >> (which I know are raised, bcoz they do get flagged when invoked from a >> mysql client) >> >> I've listed the relevant code fragments there. Am I not using mysqli >> correctly? >> >> Thanks, >> Venkat >> >
Re: [PHP-DB] PHP mysqli is NOT trapping some errors when calling stored procedure
Do you have sufficient privileges to execute stored procedures (procs_priv) on PHP's end? On Tue, Feb 12, 2019 at 11:07 AM Venkat Hariharan wrote: > Can you take a look at the issue that I've described at > > https://stackoverflow.com/questions/54643704/php-mysqli-is-not-trapping-some-errors-when-calling-stored-procedure > and tell me what I am missing in my PHP code ? > > To summarize: I am calling a MySQL stored procedure from PHP that does some > DMLs (using mysqli). But the problem is that PHP is not able to get > intimated of some database error conditions raised by the stored proc > (which I know are raised, bcoz they do get flagged when invoked from a > mysql client) > > I've listed the relevant code fragments there. Am I not using mysqli > correctly? > > Thanks, > Venkat >
Fwd: [PHP-DB] PHP ODBC odbc_fetch_array returns uninitialized values for Booleans
Thanks very much for the reply. There's very little doubt in my mind that the converted boolean value is uninitialized -- extracting a larger number of rows shows a largish number of values for the boolean columns. The postgresql tables contain true or false. This code works just fine on older systems. Bruce -- Forwarded message -- From: Bastien Koert phps...@gmail.com Date: Mon, Jun 29, 2015 at 7:21 PM Subject: Re: [PHP-DB] PHP ODBC odbc_fetch_array returns uninitialized values for Booleans To: Bruce Bailey brucebailey...@gmail.com, php-db@lists.php.net Is it a truly a three state field (true, false, null) or just T/F? Perhaps a default value for the field might be better? On Mon, Jun 29, 2015 at 11:42 AM Bruce Bailey brucebailey...@gmail.com wrote: *Description* The PHP function odbc_fetch_array returns uninitialized values for PostgreSQL boolean values. On older systems, this function returned '1' for true and '0' for false values. On our 64 bit system, the boolean values appear to be uninitialized data. *Additional information* Increasing buffer size in php_odbc.c (odbc.so) in function odbc_bindcols, just prior to call to SQLBindCol makes problem stop exhibiting. SQLColAttributes(...,SQL_COLUMN_TYPE,...) returns type of SQL_VARCHAR on system with problem, SQL_CHAR on system where code works as expected. SQLColAttributes is deprecated (shouldn't matter, though) *Recreation steps:* // Create table/data in PostgreSQL DROP TABLE IF EXISTS public.persons; create table public.persons (id int, name varchar(255), switch_sw boolean); insert into public.persons values (0, 'smith', true); insert into public.persons values (1, 'jones', false); insert into public.persons values (2, 'bailey', true); insert into public.persons values (3, 'johnson', false); // Test script ?php if(!($conn = odbc_connect(... , ... , ...))) die(odbc_connect failed\n); if(!($rows = odbc_exec($conn, select * from persons;))) die(odbc_exec failed\n); for(;;) { if (!($row = odbc_fetch_array ($rows))) break; print_r($row); } odbc_close($conn); ? *Actual output* Array ( [id] = 0 [name] = smith [switch_sw] = . // some unreadable binary content ) . . . *Expected Output* Array ( [id] = 0 [name] = smith [switch_sw] = 1 ) . . . *Software levels* kernel - Linux C921189 3.10.0-123.20.1.el7.x86_64 . . . GNU/Linux ODBC - libodbc.so.1 (cannot exactly determine version) PostgreSQL - 9.3.0 PHP - 5.6.7 This system is little endian
[PHP-DB] PHP ODBC odbc_fetch_array returns uninitialized values for Booleans
*Description* The PHP function odbc_fetch_array returns uninitialized values for PostgreSQL boolean values. On older systems, this function returned '1' for true and '0' for false values. On our 64 bit system, the boolean values appear to be uninitialized data. *Additional information* Increasing buffer size in php_odbc.c (odbc.so) in function odbc_bindcols, just prior to call to SQLBindCol makes problem stop exhibiting. SQLColAttributes(...,SQL_COLUMN_TYPE,...) returns type of SQL_VARCHAR on system with problem, SQL_CHAR on system where code works as expected. SQLColAttributes is deprecated (shouldn't matter, though) *Recreation steps:* // Create table/data in PostgreSQL DROP TABLE IF EXISTS public.persons; create table public.persons (id int, name varchar(255), switch_sw boolean); insert into public.persons values (0, 'smith', true); insert into public.persons values (1, 'jones', false); insert into public.persons values (2, 'bailey', true); insert into public.persons values (3, 'johnson', false); // Test script ?php if(!($conn = odbc_connect(... , ... , ...))) die(odbc_connect failed\n); if(!($rows = odbc_exec($conn, select * from persons;))) die(odbc_exec failed\n); for(;;) { if (!($row = odbc_fetch_array ($rows))) break; print_r($row); } odbc_close($conn); ? *Actual output* Array ( [id] = 0 [name] = smith [switch_sw] = . // some unreadable binary content ) . . . *Expected Output* Array ( [id] = 0 [name] = smith [switch_sw] = 1 ) . . . *Software levels* kernel - Linux C921189 3.10.0-123.20.1.el7.x86_64 . . . GNU/Linux ODBC - libodbc.so.1 (cannot exactly determine version) PostgreSQL - 9.3.0 PHP - 5.6.7 This system is little endian
Re: [PHP-DB] PHP ODBC odbc_fetch_array returns uninitialized values for Booleans
Is it a truly a three state field (true, false, null) or just T/F? Perhaps a default value for the field might be better? On Mon, Jun 29, 2015 at 11:42 AM Bruce Bailey brucebailey...@gmail.com wrote: *Description* The PHP function odbc_fetch_array returns uninitialized values for PostgreSQL boolean values. On older systems, this function returned '1' for true and '0' for false values. On our 64 bit system, the boolean values appear to be uninitialized data. *Additional information* Increasing buffer size in php_odbc.c (odbc.so) in function odbc_bindcols, just prior to call to SQLBindCol makes problem stop exhibiting. SQLColAttributes(...,SQL_COLUMN_TYPE,...) returns type of SQL_VARCHAR on system with problem, SQL_CHAR on system where code works as expected. SQLColAttributes is deprecated (shouldn't matter, though) *Recreation steps:* // Create table/data in PostgreSQL DROP TABLE IF EXISTS public.persons; create table public.persons (id int, name varchar(255), switch_sw boolean); insert into public.persons values (0, 'smith', true); insert into public.persons values (1, 'jones', false); insert into public.persons values (2, 'bailey', true); insert into public.persons values (3, 'johnson', false); // Test script ?php if(!($conn = odbc_connect(... , ... , ...))) die(odbc_connect failed\n); if(!($rows = odbc_exec($conn, select * from persons;))) die(odbc_exec failed\n); for(;;) { if (!($row = odbc_fetch_array ($rows))) break; print_r($row); } odbc_close($conn); ? *Actual output* Array ( [id] = 0 [name] = smith [switch_sw] = . // some unreadable binary content ) . . . *Expected Output* Array ( [id] = 0 [name] = smith [switch_sw] = 1 ) . . . *Software levels* kernel - Linux C921189 3.10.0-123.20.1.el7.x86_64 . . . GNU/Linux ODBC - libodbc.so.1 (cannot exactly determine version) PostgreSQL - 9.3.0 PHP - 5.6.7 This system is little endian
[PHP-DB] php x64 VC11 ThreadSafe (experimental) and Firebird x64 support (on windows x64)
dear members php x64 VC11 (experimental) does not yet support x64 firebird? When it will support? environment Windows Server 2012 R2 Datacenter x64 = OK Firebird 2.5.4 x64 = OK Apache Lounge 2.4.12 VC11 x64 = OK PHP 5.6.8 VC11 x64 = OK In the php.ini file extension=php_interbase.dll and extension=php_pdo_firebird.dll were uncommented. The phpinfo (); Loaded Modules core mod_win32 mpm_winnt http_core mod_so mod_access_compat mod_actions mod_alias mod_allowmethods mod_asis mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_setenvif mod_php5 but it does not show anything about Interbase / Firebird. Has anyone ever managed to run all these programs on x64 and integrate?
[PHP-DB] PHP 7 and sqlsrv
I was wondering if there is anyone who manager to compile the sqlsrv driver for php 7. I have tried, but I haven't been able to get it compiled yet. Thanks, John
[PHP-DB] PHP 5.6 OpenSSL changes and mysqli
Hello. Since 5.6, all encrypted client streams now enable peer verification by default. The problem I faced is with MySQL connection: we're connecting to old MySQL server with self-signed certificate, and are using simple SSL connection without certificates: mysql_connect(address, user, password, false, MYSQL_CLIENT_SSL); After upgrade from PHP 5.5 to 5.6, we are no longer able to connect to that server: PHP Warning: mysql_connect(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in a.php on line 25 PHP Warning: mysql_connect(): Cannot connect to MySQL by using SSL in a.php on line 25 PHP Warning: mysql_connect(): [2002] (trying to connect via tcp://address:3306) in a.php on line 25 PHP Warning: mysql_connect(): in a.php on line 25 According to docs, it is possible to disable peer certificate verification for a request by setting the verify_peer context option to FALSE, and to disable peer name validation by setting the verify_peer_name context option to FALSE. But I can't find a way to use contexts even with MySQLi - is there one? Or maybe some workarounds? Thanks.
[PHP-DB] PHP 5.3 and mariadb 5.5.32 pam auth problem.
Hi All. I have: - one devel application server with php53-mysql-5.3.27-1 MariaDB-compat-5.5.32-1.x86_64 MariaDB-common-5.5.32-1.x86_64 MariaDB-shared-5.5.32-1.x86_64 MariaDB-client-5.5.32-1.x86_64 - one devel database server with MariaDB-compat-5.5.30-1.x86_64 MariaDB-server-5.5.30-1.x86_64 MariaDB-common-5.5.30-1.x86_64 MariaDB-shared-5.5.30-1.x86_64 MariaDB-client-5.5.30-1.x86_64 When I try to make a connection from devel to database server with php mysql_connect function then when I am using: - user with local authentication: connection is ok; - user with pam/ldap authentication I get error Client does not support authentication protocol requested by server; consider upgrading MariaDB client error 1251 When I use mysql command on application server I can connect to the database server with both users, so only php does not work. Have you got similar issues? Any clues anout how to solve the problem? Best regards, Rafal Radecki.
[PHP-DB] php code for sending SMS
I wish to send a SMS to a mobile no. thru PHP/HTML. Any suggestions Please? -- Dr Vijay Kumar, E 9/18 Vasant Vihar, New Delhi-110 057 Ph: 09868 11 5354, 011-2615 4488 Email :Dr Vijay Kumarvaibhavinformat...@gmail.com
Re: [PHP-DB] php code for sending SMS
On Wed, Sep 26, 2012 at 1:18 AM, Dr Vijay Kumar vaibhavinformat...@gmail.com wrote: I wish to send a SMS to a mobile no. thru PHP/HTML. Any suggestions Please? Try an email - SMS gateway? http://en.wikipedia.org/wiki/List_of_SMS_gateways -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP-DB] Re: No data?
I apologize, I may have been mistaken about the role of $_FILES but this - http://dev.mysql.com/doc/refman/5.0/en/load-data.html confuses me. The use of $_FILES with LOAD DATA is littered over the internet and manuals as a 1 shot deal. No hand off to another directory for storage till the next function gets to it. Straight from remote drive to database in 1 single quick shot. Yours may be a work around but I honestly want it to work correctly. I'll delete the server prior to a left field hack to accommodate a failing function. :( -Original Message- From: Jim Giner [mailto:jim.gi...@albanyhandball.com] Sent: Thursday, July 26, 2012 5:17 PM To: Brad Subject: Re: [PHP-DB] Re: No data? you need to read up on how html uploads files and how php handles them. You cannot just use the temp file (I may be wrong here, but in general one doesn't use it.). You need to use the $_FILES info in order to get the uploaded temporary file and save it permanently somewhere on your server. THEN you can use it and when through with it, you can choose to delete it. That's how it works. The code that I gave you days ago accomplishes exactly that and it gets used regularly on my site, so I know that it works. Please try it and then use an ftp client to connect to your server and see that the newly uploaded file is there. Then you can do what you wish with it. On 7/26/2012 5:10 PM, Brad wrote: I don't 'have' a file. It creates a temporary file and then deletes it just as fast in /tmp/. Plus, how would I $_GET it? $_FILES is supposed to handle 'ALL' of this for me? If not, what the heck does it do? Brad Sumrall NYCTelecomm.com 212 444-2996 -Original Message- From: Jim Giner [mailto:jim.gi...@albanyhandball.com] Sent: Thursday, July 26, 2012 5:02 PM To: Brad Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Re: No data? Not sure what you mean - Program reads array. What program is doing is utilizing the FILES element to get the info about the uploaded file and proceeds to finish the upload by moving it to a temporary folder of your creation. Once that is done you HAVE the file under whatever name you want to call it in whatever folder you want it in. Why don't you just do that part and then use some tool to look at your server structure to verify that you have the file. NOW you can proceed with the rest, if you must. You're going to create a table with a column/field name matching the filename and then you'll put the contents of that file into that single column in one record of this table. So now you have a one record table with one column holding the contents of a file. How is this different from just having the file? 1 User uploads file 2 program reads array 3 program creates a table called $memberID.$filename if not exist ($filename is column) 4 program uploads data into table/column I am messed up at #2 for some reason so #4 fails. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP-DB] Re: No data?
Jim I believe your correct. Upload the file to temp move the file to your dir on your server and rename file you can also set the permissions of the file while moving it. put url to file (not temp file) in database (not the file contents) done Best, Karl On Jul 26, 2012, at 4:50 PM, Brad wrote: I apologize, I may have been mistaken about the role of $_FILES but this - http://dev.mysql.com/doc/refman/5.0/en/load-data.html confuses me. The use of $_FILES with LOAD DATA is littered over the internet and manuals as a 1 shot deal. No hand off to another directory for storage till the next function gets to it. Straight from remote drive to database in 1 single quick shot. Yours may be a work around but I honestly want it to work correctly. I'll delete the server prior to a left field hack to accommodate a failing function. :( -Original Message- From: Jim Giner [mailto:jim.gi...@albanyhandball.com] Sent: Thursday, July 26, 2012 5:17 PM To: Brad Subject: Re: [PHP-DB] Re: No data? you need to read up on how html uploads files and how php handles them. You cannot just use the temp file (I may be wrong here, but in general one doesn't use it.). You need to use the $_FILES info in order to get the uploaded temporary file and save it permanently somewhere on your server. THEN you can use it and when through with it, you can choose to delete it. That's how it works. The code that I gave you days ago accomplishes exactly that and it gets used regularly on my site, so I know that it works. Please try it and then use an ftp client to connect to your server and see that the newly uploaded file is there. Then you can do what you wish with it. On 7/26/2012 5:10 PM, Brad wrote: I don't 'have' a file. It creates a temporary file and then deletes it just as fast in /tmp/. Plus, how would I $_GET it? $_FILES is supposed to handle 'ALL' of this for me? If not, what the heck does it do? Brad Sumrall NYCTelecomm.com 212 444-2996 -Original Message- From: Jim Giner [mailto:jim.gi...@albanyhandball.com] Sent: Thursday, July 26, 2012 5:02 PM To: Brad Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Re: No data? Not sure what you mean - Program reads array. What program is doing is utilizing the FILES element to get the info about the uploaded file and proceeds to finish the upload by moving it to a temporary folder of your creation. Once that is done you HAVE the file under whatever name you want to call it in whatever folder you want it in. Why don't you just do that part and then use some tool to look at your server structure to verify that you have the file. NOW you can proceed with the rest, if you must. You're going to create a table with a column/field name matching the filename and then you'll put the contents of that file into that single column in one record of this table. So now you have a one record table with one column holding the contents of a file. How is this different from just having the file? 1 User uploads file 2 program reads array 3 program creates a table called $memberID.$filename if not exist ($filename is column) 4 program uploads data into table/column I am messed up at #2 for some reason so #4 fails. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP-DB] Re: No data?
Drats, I think you are correct. :) -Original Message- From: Karl DeSaulniers [mailto:k...@designdrumm.com] Sent: Thursday, July 26, 2012 5:59 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] PHP-DB] Re: No data? Jim I believe your correct. Upload the file to temp move the file to your dir on your server and rename file you can also set the permissions of the file while moving it. put url to file (not temp file) in database (not the file contents) done Best, Karl On Jul 26, 2012, at 4:50 PM, Brad wrote: I apologize, I may have been mistaken about the role of $_FILES but this - http://dev.mysql.com/doc/refman/5.0/en/load-data.html confuses me. The use of $_FILES with LOAD DATA is littered over the internet and manuals as a 1 shot deal. No hand off to another directory for storage till the next function gets to it. Straight from remote drive to database in 1 single quick shot. Yours may be a work around but I honestly want it to work correctly. I'll delete the server prior to a left field hack to accommodate a failing function. :( -Original Message- From: Jim Giner [mailto:jim.gi...@albanyhandball.com] Sent: Thursday, July 26, 2012 5:17 PM To: Brad Subject: Re: [PHP-DB] Re: No data? you need to read up on how html uploads files and how php handles them. You cannot just use the temp file (I may be wrong here, but in general one doesn't use it.). You need to use the $_FILES info in order to get the uploaded temporary file and save it permanently somewhere on your server. THEN you can use it and when through with it, you can choose to delete it. That's how it works. The code that I gave you days ago accomplishes exactly that and it gets used regularly on my site, so I know that it works. Please try it and then use an ftp client to connect to your server and see that the newly uploaded file is there. Then you can do what you wish with it. On 7/26/2012 5:10 PM, Brad wrote: I don't 'have' a file. It creates a temporary file and then deletes it just as fast in /tmp/. Plus, how would I $_GET it? $_FILES is supposed to handle 'ALL' of this for me? If not, what the heck does it do? Brad Sumrall NYCTelecomm.com 212 444-2996 -Original Message- From: Jim Giner [mailto:jim.gi...@albanyhandball.com] Sent: Thursday, July 26, 2012 5:02 PM To: Brad Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Re: No data? Not sure what you mean - Program reads array. What program is doing is utilizing the FILES element to get the info about the uploaded file and proceeds to finish the upload by moving it to a temporary folder of your creation. Once that is done you HAVE the file under whatever name you want to call it in whatever folder you want it in. Why don't you just do that part and then use some tool to look at your server structure to verify that you have the file. NOW you can proceed with the rest, if you must. You're going to create a table with a column/field name matching the filename and then you'll put the contents of that file into that single column in one record of this table. So now you have a one record table with one column holding the contents of a file. How is this different from just having the file? 1 User uploads file 2 program reads array 3 program creates a table called $memberID.$filename if not exist ($filename is column) 4 program uploads data into table/column I am messed up at #2 for some reason so #4 fails. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- 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] PHP MySQL High CPU on Query
I have a situation where a query run from PHP/Zend Framework on a MySQL database seems to hit the CPU harder than the same query run via the MySQL command line. The query is a simple SELECT statement querying 2 tables, 12 columns with a short WHERE clause that filters the results to less than 100 records. ZF is using the PDO adapter. I've seen the query cause mysqld to show a spike up to 50+% cpu while the query is run from a PHP call, and the same query from the client barely nudges the process to 1%. Is there something I can do to gather more data on what's going on and why this is happening? I'd expect some overhead, but that much of a difference seems wrong. Thanks for your advice, David Christensen = This electronic mail is solely for the use of the intended recipient, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient – whether as addressed or as should reasonably be surmised by the reader – you are hereby notified that any dissemination, distribution or copying of this electronic mail or any attachment is strictly prohibited. If you have received this communication in error, please do not print, copy, retransmit, disseminate or otherwise use the information contained herein or attached hereto and notify us immediately by replying to the electronic mail address listed above. After notifying us, please delete the copy you received. Thank you. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP and two phase commit transactions
Dear all, I'm the author of LIXA project (http://lixa.sourceforge.net/) and I would discuss a little about two phase commit transactions for PHP applications. Two phase commit means I can write a program that uses two (or more) Resource Managers (for example databases, like MySQL and PostgreSQL) with ACID transactions that span all the databases. With two phase commit I can perform a *global* commit that commits the changes inside two or more databases at the *same* *time*. This is quite different than performing two (or more) distinct commits: with distinct commits it may happen the first one completes and the second one catches an error. LIXA project implements two X/Open standards: XA specification and TX (transaction demarcation) specification. XA describes an interface between the Resource Managers (databases) and the Transaction Manager (for example LIXA); TX describes an interface between the Application Program (your own custom software) and the Transaction Manager (for example LIXA). The TX (transaction demarcation) specification is a C API very easy to understand and use when you are developing a C (or C++) software. When I started developing LIXA, I figured out it would have been straightforward to wrap it for other languages like PHP, Perl, Python, Ruby and so on... Unfortunately I discovered it's not easy to extend the TX API to other languages: creating a wrapper for TX API is trivial because it's just the matter of SWIG (http://www.swig.org/) hacking. Integrating the TX wrapped interface with *the* *environment* is a completely different task. These are the issues I partially solved integrating LIXA with PHP. 1. XA interface is a C level interface: the PHP database drivers must be changed at C source level to avoid many leaps between C and PHP code. The most important PHP database drivers are distributed with PHP core itself = patching their source code is equivalent to patch PHP core. 2. As a consequence of the first point, the LIXA PHP wrapper itself should be distributed with PHP core to avoid dependencies between some core extensions and an external extension. 3. The TX API does not deal with the concept of connection because it's implicit: every process/thread has its own connection with every Resource Manager (database). Better explained: tx_open(), tx_begin(), tx_commit(), tx_rollback(), tx_close() (and so on...) do not specify handlers necessary to distinguish connection objects. 4. The TX API design does not take into account the concept of persistent connection and connection pool. I afforded issues 1 and 2 creating a global experimental patch for PHP core itself (you can find it in ext/php directory of LIXA tarball or directly at SVN repository. http://lixa.svn.sourceforge.net/viewvc/lixa/ext/php/). Issue number 3 was bypassed and, for the sake of trivial hello world equivalent examples, the integration seems to work properly. Issue 4 is quite difficult to address: I ignored persistent connection disabling LIXA feature when the application asks a persistent connection, but I crashed against connection pool with Oracle (oci8) driver. It's time to made a balance of LIXA and PHP integration: I successfully integrated mysqli (with native MySQL library) and pgsql drivers. There are some examples and 7 case tests available. I was not able to figure out a smart patch for oci8 driver and I stopped my effort. To conclude, I think 98% of the use cases does *not* need two phase commit. But if you are developing the other 2% of the use cases - without two phase commit - you probably could create some clumsy solution to avoid the two phase commit issue. What do you think about PHP and two phase commit? Do you think the game isn't worth the candle? Or do you think there's room for two phase commit inside the PHP arena? In the next future I will concentrate my LIXA efforts in expanding the number of different Resource Managers for C programmers because patching PHP for LIXA integration is a too hard task for me myself. Is there someone interested in picking-up LIXA PHP experimental extension and going further with the task? Is there someone interested in two phase commit and distributed transaction processing in general? Every comment/hint/suggestion would be appreciated. Regards Ch.F. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] [PHP] PHP Database Problems -- Code Snippets - Any more Ideas?
Ethan, You have been given advise and break down on your code. Have you taken the advise given? Which part of the code isn't working? Not which chunk, but break it down and show which part BR, Gav -Original Message- From: Ethan Rosenberg [mailto:eth...@earthlink.net] Sent: 04 May 2012 15:10 To: php-db-lists.php.net; php-gene...@lists.php.net Subject: [PHP-DB] [PHP] PHP Database Problems -- Code Snippets - Any more Ideas? I am sending this again to see if more ideas for solution of this problem are available. Ethan === Dear list - Sorry for the attachment. Here are code snippets --- GET THE DATA FROM INTAKE3: function handle_data() { global $cxn; $query = select * from Intake3 where 1; if(isset($_Request['Sex']) trim($_POST['Sex']) != '' ) { if ($_REQUEST['Sex'] === 0) { $sex = 'Male'; } else { $sex = 'Female'; } } } $allowed_fields = array ( 'Site' =$_POST['Site'], 'MedRec' = $_POST['MedRec'], 'Fname' = $_POST['Fname'], 'Lname' = $_POST['Lname'] , 'Phone' = $_POST['Phone'] , 'Sex' = $_POST['Sex'] , 'Height' = $_POST['Height'] ); if(empty($allowed_fields)) { echo ouch; } $query = select * from Intake3 where 1 ; foreach ( $allowed_fields as $key = $val ) { if ( (($val != '')) ) { $query .= AND ($key = '$val') ; } $result1 = mysqli_query($cxn, $query); } $num = mysqli_num_rows($result1); if(($num = mysqli_num_rows($result1)) == 0) { ? br /br /centerbp style=color: red; font-size:14pt; No Records Retrieved #1/center/b/style/p ?php exit(); } DISPLAY THE INPUT3 DATA: THIS SEEMS TO BE THE ROUTINE THAT IS FAILING centerbSearch Results/b/centerbr / centertable border=4 cellpadding=5 cellspacing=55 rules=all frame=box tr class=\heading\ thSite/th thMedical Record/th thFirst Name/th thLast Name/th thPhone/td thHeight/td thSex/td thHistory/td /tr ?php while ($row1 = mysqli_fetch_array($result1, MYSQLI_BOTH)) { print_r($_POST); global $MDRcheck; $n1++; echo br /n1 br /;echo $n1; { if (($n1 2) ($MDRcheck == $row1[1])) { echo 2== ; echo $MDRcheck; echo td $row1[0] /td\n; echo td $row1[1] /td\n; echo td $row1[2] /td\n; echo td $row1[3] /td\n; echo td $row1[4] /td\n; echo td $row1[5] /td\n; echo td $row1[6] /td\n; echo td $row1[7] /td\n; echo /tr\n; } elseif (($n1 2) ($MDRcheck != $row1[1])) { echo 2!= ; echo $MDRcheck; continue; } elseif ($n1 == 2) { define( MDR , $row1[1]); echo br /row1 br;echo $row1[1]; echo tr\n; $_GLOBALS['mdr']= $row1[1]; $_POST['MedRec'] = $row1[1]; $MDRold = $_GLOBALS['mdr']; echo td $row1[0] /td\n; echo td $row1[1] /td\n; echo td $row1[2] /td\n; echo td $row1[3] /td\n; echo td $row1[4] /td\n; echo td $row1[5] /td\n; echo td $row1[6] /td\n; echo td $row1[7] /td\n; echo /tr\n; } } } ? SELECT AND DISPLAY DATA FROM VISIT3 DATABASE ?php $query2 = select * from Visit3 where 1 AND (Site = 'AA') AND (MedRec = $_GLOBALS[mdr]); $result2 = mysqli_query($cxn, $query2); $num = mysqli_num_rows($result2); global $finished; $finished = 0; while($row2 = mysqli_fetch_array($result2, MYSQLI_BOTH)) { global $finished; echo tr\n; echo td $row2[0] /td\n; echo td $row2[1] /td\n; echo td $row2[2] /td\n; echo td $row2[3] /td\n; echo td $row2[4] /td\n; echo td $row2[5] /td\n; echo td $row2[6] /td\n; echo /tr\n; } echo /table; ENTER MORE DATA: function More_Data() { $decision = 5; ? Do you Wish to Enter More Data? form method=post action= centerinput type=radio name=decision value=1 /Yes input type=radio name=decision value=0 /No/centerbr / centerinput type=submit value=Enter more Data //center input type=hidden name=next_step value=step10 / /form ?php } //end
[PHP-DB] PHP Database Problems
have a database mysql describe Intake3; ++-+--+-+-+---+ | Field | Type| Null | Key | Default | Extra | ++-+--+-+-+---+ | Site | varchar(6) | NO | PRI | | | | MedRec | int(6) | NO | PRI | NULL| | | Fname | varchar(15) | YES | | NULL| | | Lname | varchar(30) | YES | | NULL| | | Phone | varchar(30) | YES | | NULL| | | Height | int(4) | YES | | NULL| | | Sex| char(7) | YES | | NULL| | | Hx | text| YES | | NULL| | ++-+--+-+-+---+ 8 rows in set (0.00 sec) mysql describe Visit3; ++--+--+-+-++ | Field | Type | Null | Key | Default | Extra | ++--+--+-+-++ | Indx | int(4) | NO | PRI | NULL| auto_increment | | Site | varchar(6) | YES | | NULL|| | MedRec | int(6) | YES | | NULL|| | Notes | text | YES | | NULL|| | Weight | int(4) | YES | | NULL|| | BMI| decimal(3,1) | YES | | NULL|| | Date | date | YES | | NULL|| ++--+--+-+-++ and a program to enter and extract data. I can easily extract data from the database. However, if I try to enter data, it goes into the incorrect record. Following are some screenshots. The program is attached. [pardon the comical names. This is a test, and any resemblance to true names is not intentional] Let us say that I wish to deal with Medical Record 1: This it data from Intake3: Site Medical Record First Name Last Name Phone Height Sex History AA 1 David Dummy 845 365-1456 66 Male c/o obesity. Various treatments w/o success This is data from Visit3: Index Site Medical Record Notes Weight BMI Date 2322 AA 1 Second Visit. 170 27.4 2010-01-20 2326 AA 1 Third visit. Small progress, but pt is very happy. 165 26.6 2010-02-01 I then request to enter additional data: Site Medical Record First Name Last Name Phone Height Sex History AA 10003 Stupid Fool 325 563-4178 65 Male Has been convinced by his friends that he is obese. Normal BMI = 23. Index Site Medical Record Notes Weight BMI Date Notice that it is entered into record 10003 The data is First Try Index Site Medical Record Notes Weight BMI Date 2590 AA 10003 First Try 189 31.4 02 May 2012 Help and advice, please. Thanks. Ethan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP Database Problems
Ethan, Some coding you are using would be helpful (as far as i am aware attachments are not support on the mailing list's) Gav -Original Message- From: Ethan Rosenberg [mailto:eth...@earthlink.net] Sent: 02 May 2012 19:54 To: php-db-lists.php.net; php-gene...@lists.php.net Subject: [PHP-DB] PHP Database Problems have a database mysql describe Intake3; ++-+--+-+-+---+ | Field | Type| Null | Key | Default | Extra | ++-+--+-+-+---+ | Site | varchar(6) | NO | PRI | | | | MedRec | int(6) | NO | PRI | NULL| | | Fname | varchar(15) | YES | | NULL| | | Lname | varchar(30) | YES | | NULL| | | Phone | varchar(30) | YES | | NULL| | | Height | int(4) | YES | | NULL| | | Sex| char(7) | YES | | NULL| | | Hx | text| YES | | NULL| | ++-+--+-+-+---+ 8 rows in set (0.00 sec) mysql describe Visit3; ++--+--+-+-++ | Field | Type | Null | Key | Default | Extra | ++--+--+-+-++ | Indx | int(4) | NO | PRI | NULL| auto_increment | | Site | varchar(6) | YES | | NULL|| | MedRec | int(6) | YES | | NULL|| | Notes | text | YES | | NULL|| | Weight | int(4) | YES | | NULL|| | BMI| decimal(3,1) | YES | | NULL|| | Date | date | YES | | NULL|| ++--+--+-+-++ and a program to enter and extract data. I can easily extract data from the database. However, if I try to enter data, it goes into the incorrect record. Following are some screenshots. The program is attached. [pardon the comical names. This is a test, and any resemblance to true names is not intentional] Let us say that I wish to deal with Medical Record 1: This it data from Intake3: Site Medical Record First Name Last Name Phone Height Sex History AA 1 David Dummy 845 365-1456 66 Male c/o obesity. Various treatments w/o success This is data from Visit3: Index Site Medical Record Notes Weight BMI Date 2322 AA 1 Second Visit. 170 27.4 2010-01-20 2326 AA 1 Third visit. Small progress, but pt is very happy. 165 26.6 2010-02-01 I then request to enter additional data: Site Medical Record First Name Last Name Phone Height Sex History AA 10003 Stupid Fool 325 563-4178 65 Male Has been convinced by his friends that he is obese. Normal BMI = 23. Index Site Medical Record Notes Weight BMI Date Notice that it is entered into record 10003 The data is First Try Index Site Medical Record Notes Weight BMI Date 2590 AA 10003 First Try 189 31.4 02 May 2012 Help and advice, please. Thanks. Ethan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP Database Problems -- Code Snippets
Dear list - Sorry for the attachment. Here are code snippets --- GET THE DATA FROM INTAKE3: function handle_data() { global $cxn; $query = select * from Intake3 where 1; if(isset($_Request['Sex']) trim($_POST['Sex']) != '' ) { if ($_REQUEST['Sex'] === 0) { $sex = 'Male'; } else { $sex = 'Female'; } } } $allowed_fields = array ( 'Site' =$_POST['Site'], 'MedRec' = $_POST['MedRec'], 'Fname' = $_POST['Fname'], 'Lname' = $_POST['Lname'] , 'Phone' = $_POST['Phone'] , 'Sex' = $_POST['Sex'] , 'Height' = $_POST['Height'] ); if(empty($allowed_fields)) { echo ouch; } $query = select * from Intake3 where 1 ; foreach ( $allowed_fields as $key = $val ) { if ( (($val != '')) ) { $query .= AND ($key = '$val') ; } $result1 = mysqli_query($cxn, $query); } $num = mysqli_num_rows($result1); if(($num = mysqli_num_rows($result1)) == 0) { ? br /br /centerbp style=color: red; font-size:14pt; No Records Retrieved #1/center/b/style/p ?php exit(); } DISPLAY THE INPUT3 DATA: THIS SEEMS TO BE THE ROUTINE THAT IS FAILING centerbSearch Results/b/centerbr / centertable border=4 cellpadding=5 cellspacing=55 rules=all frame=box tr class=\heading\ thSite/th thMedical Record/th thFirst Name/th thLast Name/th thPhone/td thHeight/td thSex/td thHistory/td /tr ?php while ($row1 = mysqli_fetch_array($result1, MYSQLI_BOTH)) { print_r($_POST); global $MDRcheck; $n1++; echo br /n1 br /;echo $n1; { if (($n1 2) ($MDRcheck == $row1[1])) { echo 2== ; echo $MDRcheck; echo td $row1[0] /td\n; echo td $row1[1] /td\n; echo td $row1[2] /td\n; echo td $row1[3] /td\n; echo td $row1[4] /td\n; echo td $row1[5] /td\n; echo td $row1[6] /td\n; echo td $row1[7] /td\n; echo /tr\n; } elseif (($n1 2) ($MDRcheck != $row1[1])) { echo 2!= ; echo $MDRcheck; continue; } elseif ($n1 == 2) { define( MDR , $row1[1]); echo br /row1 br;echo $row1[1]; echo tr\n; $_GLOBALS['mdr']= $row1[1]; $_POST['MedRec'] = $row1[1]; $MDRold = $_GLOBALS['mdr']; echo td $row1[0] /td\n; echo td $row1[1] /td\n; echo td $row1[2] /td\n; echo td $row1[3] /td\n; echo td $row1[4] /td\n; echo td $row1[5] /td\n; echo td $row1[6] /td\n; echo td $row1[7] /td\n; echo /tr\n; } } } ? SELECT AND DISPLAY DATA FROM VISIT3 DATABASE ?php $query2 = select * from Visit3 where 1 AND (Site = 'AA') AND (MedRec = $_GLOBALS[mdr]); $result2 = mysqli_query($cxn, $query2); $num = mysqli_num_rows($result2); global $finished; $finished = 0; while($row2 = mysqli_fetch_array($result2, MYSQLI_BOTH)) { global $finished; echo tr\n; echo td $row2[0] /td\n; echo td $row2[1] /td\n; echo td $row2[2] /td\n; echo td $row2[3] /td\n; echo td $row2[4] /td\n; echo td $row2[5] /td\n; echo td $row2[6] /td\n; echo /tr\n; } echo /table; ENTER MORE DATA: function More_Data() { $decision = 5; ? Do you Wish to Enter More Data? form method=post action= centerinput type=radio name=decision value=1 /Yes input type=radio name=decision value=0 /No/centerbr / centerinput type=submit value=Enter more Data //center input type=hidden name=next_step value=step10 / /form ?php } //end function More_Data switch ( @$_POST[next_step] ) { case step10: { if (!isset($_POST['decision'])) { $_POST['decision'] = 5; } if ($_POST['decision'] == 0) { exit(); } if ($_POST['decision'] == 1) { ; echo form method=\post\ action=\\; echo input type=\hidden\ name=\next_step\ value=\step4\ /; echo enterbr /; echo Medical Record: nbspinput type=\text\ name=\MedRec\ value=\ $_GLOBALS[mdr]\ /; echo nbspnbsp Weight: input type=\decimal\
Re: [PHP-DB] php adodb book suggestins
On Thu, 2012-01-26 at 11:59 +, Lester Caine wrote: David McGlone wrote: On Thu, 2012-01-26 at 08:45 +, Lester Caine wrote: David McGlone wrote: can anyone suggest any good up to date books out there on php adodb. The only documentation on ADOdb is the website http://adodb.sourceforge.net/#docs ... has ANYBODY seen it described in a php book? While I have bought a couple of php books, the on-line material is always more up to date and asking often fills in gaps that one had not even thought of. Thanks Lester. I've been playing around with it a lot, but haven't got as comfortable with is as I was with PEAR. :-/ I started with PHP just before PHP5 was finally released, so never used PHP4, and found ADOdb very early on so have never used anything else. One gets stuck in one's way when something simply works ... Probably why I'm finding PDO such a backwards step having been spoilt by the transparent cross db support ADOdb provides. I only use Firebird in production, but pulling stuff from other data sources is a doddle nowadays. Sadly this is true. quite a few times already I've thought about just going back to PEAR. It doesn't have much to do with the code itself, it's more of that at home feel. I also have these thoughts that if PEAR went belly up, so could ADOdb. Scary thought indeed. :-/ -- David M. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php adodb book suggestins
David McGlone wrote: I started with PHP just before PHP5 was finally released, so never used PHP4, and found ADOdb very early on so have never used anything else. One gets stuck in one's way when something simply works ... Probably why I'm finding PDO such a backwards step having been spoilt by the transparent cross db support ADOdb provides. I only use Firebird in production, but pulling stuff from other data sources is a doddle nowadays. Sadly this is true. quite a few times already I've thought about just going back to PEAR. It doesn't have much to do with the code itself, it's more of that at home feel. I also have these thoughts that if PEAR went belly up, so could ADOdb. Scary thought indeed. :-/ I do my own mods to ADOdb ;) So it does not bother me, certainly a LOT less than having to cope with all the 'improvements' in PHP itself! -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php adodb book suggestins
On Thu, 2012-01-26 at 08:45 +, Lester Caine wrote: David McGlone wrote: can anyone suggest any good up to date books out there on php adodb. The only documentation on ADOdb is the website http://adodb.sourceforge.net/#docs ... has ANYBODY seen it described in a php book? While I have bought a couple of php books, the on-line material is always more up to date and asking often fills in gaps that one had not even thought of. Thanks Lester. I've been playing around with it a lot, but haven't got as comfortable with is as I was with PEAR. :-/ -- David M. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php adodb book suggestins
David McGlone wrote: On Thu, 2012-01-26 at 08:45 +, Lester Caine wrote: David McGlone wrote: can anyone suggest any good up to date books out there on php adodb. The only documentation on ADOdb is the website http://adodb.sourceforge.net/#docs ... has ANYBODY seen it described in a php book? While I have bought a couple of php books, the on-line material is always more up to date and asking often fills in gaps that one had not even thought of. Thanks Lester. I've been playing around with it a lot, but haven't got as comfortable with is as I was with PEAR. :-/ I started with PHP just before PHP5 was finally released, so never used PHP4, and found ADOdb very early on so have never used anything else. One gets stuck in one's way when something simply works ... Probably why I'm finding PDO such a backwards step having been spoilt by the transparent cross db support ADOdb provides. I only use Firebird in production, but pulling stuff from other data sources is a doddle nowadays. -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php adodb book suggestins
On Thu, Jan 26, 2012 at 12:06 PM, David McGlone da...@dmcentral.net wrote: On Thu, 2012-01-26 at 08:45 +, Lester Caine wrote: David McGlone wrote: can anyone suggest any good up to date books out there on php adodb. The only documentation on ADOdb is the website http://adodb.sourceforge.net/#docs ... has ANYBODY seen it described in a php book? While I have bought a couple of php books, the on-line material is always more up to date and asking often fills in gaps that one had not even thought of. Yes, it is described in the book Object-Oriented Programming with PHP5, though it is pretty limited. - Matijn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php adodb book suggestins
can anyone suggest any good up to date books out there on php adodb. -- David M. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP, PDO and MS-SQL ?
Hi, could someone tell me what I need to install and how to configure everything so that I can connect with PHP and PDO to a MS-SQL server? I have an OpenSuse 11.4 installation. I added the Apache-PHP repository and upgraded to PHP 5.3.8. php-mssql, -php-odbc, libfreetds and the freetds-tools are installed. Do I need all this or anything else? phpinfos() reports the odbc and mssql modules are loaded. I can't find config files, though. The aim is to connect to a ms-sql server using PDO without a system dsn if possible. Is there a detailed description for people who don't know everything about this stuff, yet? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP + SQLite - Issues with update
Try using the query: $db-query(update SERVER set Token = '$intoken' where IPAddress ='192.168.1.100'); You are trying to update all rows with $intoken, where the column Token is unique. Regards, Neil Morgan -Original Message- From: Prashant Prabhudesai [mailto:pprab...@cisco.com] Sent: 21 October 2011 04:04 To: php-db@lists.php.net Subject: [PHP-DB] PHP + SQLite - Issues with update Hello, I am running into some issues trying to update a column in a table in a SQLite database using PHP on Windows and was hoping could get some help on this mailer. Here is the create and insert statement - CREATE TABLE SERVER ( IPAddress varchar(100) not null unique primary key, Token varchar(100) unique ); INSERT INTO SERVER (IPAddress, Token) VALUES ('192.168.1.100', ''); I am trying to update the Token field using the following code - [snip] $db = new SQLiteDatabase('db/reg.s3db'); $intoken = uniqid(); $db-query(update SERVER set Token = '$intoken'); $res = $db-query(select * from SERVER); $row = $res-fecth(); $outtoken = $row['Token']; echo $outtoken; [snip] After the script exits successfully I inspect the value in the Token column and its empty. But the echo statement in the snippet above prints the proper value. Interestingly, if I error out the script with a syntax error or some such after the update but before it exits, the value shows up in the Token column. Any idea what is happening here and I need to do here. Seems like there is some sort of flush that needs to happen which happens only if the script errors out. Any help is appreciated. Thanks, Prashant. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ This email has been scanned by MessageLabs' Email Security System on behalf of the University of Brighton. For more information see http://www.brighton.ac.uk/is/spam/ ___ ___ This email has been scanned by MessageLabs' Email Security System on behalf of the University of Brighton. For more information see http://www.brighton.ac.uk/is/spam/ ___ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP + SQLite - Issues with update
Had already tried that without any success. What bugs me is that if I error the script out rather than exit it cleanly the token value shows up in the DB. It's causing me to wonder if it's some streams issue. Even if it was, I have no idea how to fix it. Thanks, Prashant. -Original Message- From: n.a.mor...@brighton.ac.uk [mailto:n.a.mor...@brighton.ac.uk] Sent: Friday, October 21, 2011 2:33 AM To: Prashant Prabhudesai (pprabhud); php-db@lists.php.net Subject: RE: [PHP-DB] PHP + SQLite - Issues with update Try using the query: $db-query(update SERVER set Token = '$intoken' where IPAddress ='192.168.1.100'); You are trying to update all rows with $intoken, where the column Token is unique. Regards, Neil Morgan -Original Message- From: Prashant Prabhudesai [mailto:pprab...@cisco.com] Sent: 21 October 2011 04:04 To: php-db@lists.php.net Subject: [PHP-DB] PHP + SQLite - Issues with update Hello, I am running into some issues trying to update a column in a table in a SQLite database using PHP on Windows and was hoping could get some help on this mailer. Here is the create and insert statement - CREATE TABLE SERVER ( IPAddress varchar(100) not null unique primary key, Token varchar(100) unique ); INSERT INTO SERVER (IPAddress, Token) VALUES ('192.168.1.100', ''); I am trying to update the Token field using the following code - [snip] $db = new SQLiteDatabase('db/reg.s3db'); $intoken = uniqid(); $db-query(update SERVER set Token = '$intoken'); $res = $db-query(select * from SERVER); $row = $res-fecth(); $outtoken = $row['Token']; echo $outtoken; [snip] After the script exits successfully I inspect the value in the Token column and its empty. But the echo statement in the snippet above prints the proper value. Interestingly, if I error out the script with a syntax error or some such after the update but before it exits, the value shows up in the Token column. Any idea what is happening here and I need to do here. Seems like there is some sort of flush that needs to happen which happens only if the script errors out. Any help is appreciated. Thanks, Prashant. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ This email has been scanned by MessageLabs' Email Security System on behalf of the University of Brighton. For more information see http://www.brighton.ac.uk/is/spam/ ___ ___ This email has been scanned by MessageLabs' Email Security System on behalf of the University of Brighton. For more information see http://www.brighton.ac.uk/is/spam/ ___ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP + SQLite - Issues with update
Hello, I am running into some issues trying to update a column in a table in a SQLite database using PHP on Windows and was hoping could get some help on this mailer. Here is the create and insert statement - CREATE TABLE SERVER ( IPAddress varchar(100) not null unique primary key, Token varchar(100) unique ); INSERT INTO SERVER (IPAddress, Token) VALUES ('192.168.1.100', ''); I am trying to update the Token field using the following code - [snip] $db = new SQLiteDatabase('db/reg.s3db'); $intoken = uniqid(); $db-query(update SERVER set Token = '$intoken'); $res = $db-query(select * from SERVER); $row = $res-fecth(); $outtoken = $row['Token']; echo $outtoken; [snip] After the script exits successfully I inspect the value in the Token column and its empty. But the echo statement in the snippet above prints the proper value. Interestingly, if I error out the script with a syntax error or some such after the update but before it exits, the value shows up in the Token column. Any idea what is happening here and I need to do here. Seems like there is some sort of flush that needs to happen which happens only if the script errors out. Any help is appreciated. Thanks, Prashant. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP EOL
Hello All, Happy pre independence for my American PHPers. And good health to all others. Have a quick question.. I have this code I use for the end of line characters used in my mailers. [Code] // Is the OS Windows or Mac or Linux if (strtoupper(substr(PHP_OS,0,5)=='WIN')) { $eol=\r\n; } else if (strtoupper(substr(PHP_OS,0,5)=='MAC')) { $eol=\r; } else { $eol=\n; } [End Code] Does this suffice or should I be using the php supplied end of line? $eol=PHP_EOL; Or do these do the same thing? What advantages over the code I use does the PHP_EOL have? Or does it not matter with these and either are good to go? It seems to me that they do the same thing.. am I on the right track or missing something? Is there any other OS's that are not WIN or MAC and use the \r or \r\n ? If their are, then I can see an advantage of using the PHP_EOL. Like I said, just a quick question. ;) Karl DeSaulniers Design Drumm http://designdrumm.com
Re: [PHP-DB] PHP EOL
On Jul 2, 2011, at 3:01 AM, Karl DeSaulniers wrote: Hello All, Happy pre independence for my American PHPers. And good health to all others. Have a quick question.. I have this code I use for the end of line characters used in my mailers. [Code] // Is the OS Windows or Mac or Linux if (strtoupper(substr(PHP_OS,0,5)=='WIN')) { $eol=\r\n; } else if (strtoupper(substr(PHP_OS,0,5)=='MAC')) { $eol=\r; } else { $eol=\n; } [End Code] Does this suffice or should I be using the php supplied end of line? $eol=PHP_EOL; Or do these do the same thing? What advantages over the code I use does the PHP_EOL have? Or does it not matter with these and either are good to go? It seems to me that they do the same thing.. am I on the right track or missing something? Is there any other OS's that are not WIN or MAC and use the \r or \r\n ? If their are, then I can see an advantage of using the PHP_EOL. Like I said, just a quick question. ;) Karl DeSaulniers Design Drumm http://designdrumm.com Oops sory for the cross post. I am a bit of a list novice. Wont happen again. Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP Delete confirmation
I have been trying to figure out how to add delete confirmation for the bellow snippet of code. I would prefer not to use javascript. Can anyone offer any advise on how to right the delete confirmation in PHP? Thank you in advance. P.S. I apologize for the indention. For some reason gmail messes it up. ?php // loop through results of database query, displaying them in the table while($row = mysql_fetch_array( $result )) { // echo out the contents of each row into a table echo tr; echo 'td' . $row['Name'] . '/td'; echo 'td' . $row['Date'] . '/td'; echo 'td' . $row['StoreInfo'] . '/td'; echo 'td' . $row['Address'] . '/td'; echo 'td' . $row['Type'] . '/td'; echo 'td' . $row['EngTech'] . '/td'; echo 'td' . $row['StoreManager'] . '/td'; echo 'td' . $row['BBtime'] . '/td'; echo 'td' . $row['BBup'] . '/td'; echo 'td' . $row['BBdown'] . '/td'; echo 'td' . $row['SiteSect'] . '/td'; echo 'td' . $row['VoiceCall'] . '/td'; echo 'td' . $row['Comments'] . '/td'; echo 'tda href=edit.php?id=' . $row['id'] .'Edit/a/td'; echo 'tda href=delete.php?id=' . $row['id'] .'Delete/a/td'; echo /tr; } // close table echo /table; ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysql.so'
Hi, I installed mysql and php. Its OK. After I install php-mysql, the following messages come out. PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysql.so' - libmysqlclient.so.15: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysqli.so' - libmysqlclient.so.15: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_mysql.so' - libmysqlclient.so.15: cannot open shared object file: No such file or directory in Unknown on line 0 The file of libmysqlclient.so.15 is located in /usr/lib/mysql and this folder is in ld.so.conf. But libmysqlclient.so.15 works fine in DBD::mysql and command line mysql (OS- fedora linux 8, mysql-5.0.45, php-5.2.6, php-mysql-5.2.6) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysql.so'
Are you getting any error msg while installing it. Try to get a new copy of php-mysql from internet and install it. On Tue, Mar 8, 2011 at 4:17 PM, Scott Wen wen.xue...@gmail.com wrote: Hi, I installed mysql and php. Its OK. After I install php-mysql, the following messages come out. PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysql.so' - libmysqlclient.so.15: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysqli.so' - libmysqlclient.so.15: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_mysql.so' - libmysqlclient.so.15: cannot open shared object file: No such file or directory in Unknown on line 0 The file of libmysqlclient.so.15 is located in /usr/lib/mysql and this folder is in ld.so.conf. But libmysqlclient.so.15 works fine in DBD::mysql and command line mysql (OS- fedora linux 8, mysql-5.0.45, php-5.2.6, php-mysql-5.2.6) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php as cgi and sqlite
Hello, http://arado.sf.net is a URL database / Open Source Websearch Engine and RSS Reader, in c++ /qt using sqlite. the urlbase.sql is currently addressed by a Qt gui. There is as well the code for a php interface to address the urlbase.sql. The PDO does not interact proper, has anyone experience and interest in testing the code and making a php interface for arado, so that users can run it as a portal on their webservers? As we release the new code in a few days, feedback is welcome. Could and test urlbase file can be sent. Thanks and regards Randolph Dohm -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP Search DB Table
Hello Everyone Apologies if I have not done this in the correct way, this is the first time I have turned to your for help so I am unaware if I have to submit this according to a certain protocol, if that is the case then please let me know and I will go through the proper channels. My problem is this. I have a very simple database consisting of 1 table, I want users here to be able to use a search function to query the database in order to return the information on a client by a specific ID number if it is in the database. My search form is this body div id=container form action='datasearch.php' method='POST' div id =options plabelSearch by Client IDbr /input type=text name=searchx //label/p pinput type=submit value=Search //p /div /div /form /body /html and my process form is this ?php $term = $_REQUEST['searchx']; mysql_connect(localhost, root, *) or die (mysql_error()); mysql_select_db(moneyl) or die(mysql_error()); $result = mysql_query(SELECT * FROM clients WHERE clientid = '$term') or die(mysql_error()); echotable border='1'; echo trthClient ID/th thFeeearner/th thFirst Name/th thMiddle Name/th thLast Name/th thHouse/Flat Number/th thAddress/th thPostcode/th thGender/th thDate of Birth/th thLandline/th; while($row = mysql_fetch_array( $result )) { echo trtd; echo$row['clientid']; echo/tdtd; echo$row['feeearner']; echo/tdtd; echo$row['firstname']; echo/tdtd; echo$row['middlename']; echo/tdtd; echo$row['lastname']; echo/tdtd; echo$row['hfnumber']; echo/tdtd; echo$row['address']; echo/tdtd; echo$row['postcode']; echo/tdtd; echo$row['gender']; echo/tdtd; echo$row['dob']; echo/tdtd; echo$row['landline']; echo/td/tr; } echo/table; ? I know the form is connecting an retrieving okay because if I change the WHERE client id = '' to a specific number of a client ID in the database then it comes back with that information, so essentially it is not pulling through the numbers entered into the search box the value for which I have used REQUEST for and specified it with the value $term. I am a beginner at this and am trying to do something to impress the powers-that-be at work, this is now the last stumbling block. Any help would be appreciated. Regards Oliver
[PHP-DB] [PHP] mySQL query assistance...
On Mon, Nov 29, 2010 at 14:35, Don Wieland d...@dwdataconcepts.com wrote: Hi all, Is there a list/form to get some help on compiling mySQL queries? I am executing them via PHP, but do not want to ask for help here if it is no the appropriate forum. Thanks ;-) Yes. For MySQL queries, write to the MySQL General list at my...@lists.mysql.com. For PHP-specific database questions (for any database backend, not strictly MySQL), such as problems in connecting to the database, questions on support for database platform/version, or even query processing, you should use php...@lists.php.net. For your convenience, both have been CC'd on this email. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Exercises
Sanjay Mantoor wrote: Twaha, I found PHP manual is best. Refer http://www.php.net/manual/en/ On Fri, Oct 31, 2008 at 1:49 PM, Twaha Uddessy udde...@yahoo.com wrote: Hello all, Iam new here,trying hard to study PHP.Can anyone help me with a link where I can get PHP exercises and possible solution?. Thank you in advance -- Sanjay Mantoor -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I know this post is old, but if you are still looking for PHP exercises, there's a http://phpexercises.com site with 26 beginner to intemediate exercises. The site is PHP Exercises, and it covers variables, control structures, forms, arrays and functions, as well as some other things. You see the problem first, then click a button for the answer script and a link to the script's output. We just set it up, and would appreciate comments about how it works. -- View this message in context: http://old.nabble.com/PHP-Exercises-tp20261635p30099292.html Sent from the Php - Database mailing list archive at Nabble.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP application hosted on a dektop ubuntu(localhost) vs A .NET software installed on Windows
Hello, without further information, it is not really possible to give any kind of indication that a web app can replace the original app. We do not know what the original app is supposed to do, how it works, ... Having said that, I think most apps would be possible to transform to some web app. That does not mean it is generally a good or bad idea, that depends on the situation. Since you already suggested you are avoiding the process of an installable software, I think that may actually be what you are trying. regards, Maarten On Fri, 2010-08-06 at 07:45 +0530, Vinay Kannan wrote: Hi, I need some help and its actually got nothing to do with any coding help. My friend owns a business and has been using a software developed on VB6.0 installed on a Windows XP it is a bit outdated though and I personally feel the company which sold the software has overdone the sales, coz I personally feel its way too crappy. Now that my buddy has asked me to get a software developed for him if I would like to. I am thinking that since I am more of a web app guy than the traditional software developer, would it make any sense to develop an application which would run on localhost on a Ubuntu Desktop ? I am not sure if it does sound like an appropriate alternative or does it sound like someone trying to avoid the process of an installable software ? Also if it can be done, then Ideally what are the things that I should be taking care off ? and was really keen to know how many of you have come across situations like these and offered solutions like this if atall Thanks, Vinay Kannan. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP application hosted on a dektop ubuntu(localhost) vs A .NET software installed on Windows
Thanks for your reply Maarten, Its a hotel management application for a hotel.. Thanks, Vinay On Fri, Aug 6, 2010 at 1:03 PM, maarten maarten.fo...@edchq.com wrote: Hello, without further information, it is not really possible to give any kind of indication that a web app can replace the original app. We do not know what the original app is supposed to do, how it works, ... Having said that, I think most apps would be possible to transform to some web app. That does not mean it is generally a good or bad idea, that depends on the situation. Since you already suggested you are avoiding the process of an installable software, I think that may actually be what you are trying. regards, Maarten On Fri, 2010-08-06 at 07:45 +0530, Vinay Kannan wrote: Hi, I need some help and its actually got nothing to do with any coding help. My friend owns a business and has been using a software developed on VB6.0 installed on a Windows XP it is a bit outdated though and I personally feel the company which sold the software has overdone the sales, coz I personally feel its way too crappy. Now that my buddy has asked me to get a software developed for him if I would like to. I am thinking that since I am more of a web app guy than the traditional software developer, would it make any sense to develop an application which would run on localhost on a Ubuntu Desktop ? I am not sure if it does sound like an appropriate alternative or does it sound like someone trying to avoid the process of an installable software ? Also if it can be done, then Ideally what are the things that I should be taking care off ? and was really keen to know how many of you have come across situations like these and offered solutions like this if atall Thanks, Vinay Kannan. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP application hosted on a dektop ubuntu(localhost) vs A .NET software installed on Windows
Actually there is no customer registrations happening, its just a resturant and there wouldnt be any registrations and stuff, its a valid point of hosting it on a webserver and building it like any web app, but then internet connection might also be a problem in that area, and if the internet doesnt work well, the entire app doesnt work, So for the long term like you said it would be made available as a hosted application, but still the system needs to be able to perform all the functions even as a stand alone. Thanks, Vinay On Sat, Aug 7, 2010 at 1:11 AM, Mike Stowe mikegst...@gmail.com wrote: Just a stupid question... But if you build it as a web app hosted on a server, wouldn't that provide for easy development of an online, customer end registration portal-- assuming they have a website? I know that's not what the original ? was, just trying to think long term. - Mike Sent from my iPhone On Aug 6, 2010, at 1:13 PM, Vinay Kannan viny...@gmail.com wrote: Thanks for your reply Maarten, Its a hotel management application for a hotel.. Thanks, Vinay On Fri, Aug 6, 2010 at 1:03 PM, maarten maarten.fo...@edchq.com wrote: Hello, without further information, it is not really possible to give any kind of indication that a web app can replace the original app. We do not know what the original app is supposed to do, how it works, ... Having said that, I think most apps would be possible to transform to some web app. That does not mean it is generally a good or bad idea, that depends on the situation. Since you already suggested you are avoiding the process of an installable software, I think that may actually be what you are trying. regards, Maarten On Fri, 2010-08-06 at 07:45 +0530, Vinay Kannan wrote: Hi, I need some help and its actually got nothing to do with any coding help. My friend owns a business and has been using a software developed on VB6.0 installed on a Windows XP it is a bit outdated though and I personally feel the company which sold the software has overdone the sales, coz I personally feel its way too crappy. Now that my buddy has asked me to get a software developed for him if I would like to. I am thinking that since I am more of a web app guy than the traditional software developer, would it make any sense to develop an application which would run on localhost on a Ubuntu Desktop ? I am not sure if it does sound like an appropriate alternative or does it sound like someone trying to avoid the process of an installable software ? Also if it can be done, then Ideally what are the things that I should be taking care off ? and was really keen to know how many of you have come across situations like these and offered solutions like this if atall Thanks, Vinay Kannan. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP application hosted on a dektop ubuntu(localhost) vs A .NET software installed on Windows
Hi, I need some help and its actually got nothing to do with any coding help. My friend owns a business and has been using a software developed on VB6.0 installed on a Windows XP it is a bit outdated though and I personally feel the company which sold the software has overdone the sales, coz I personally feel its way too crappy. Now that my buddy has asked me to get a software developed for him if I would like to. I am thinking that since I am more of a web app guy than the traditional software developer, would it make any sense to develop an application which would run on localhost on a Ubuntu Desktop ? I am not sure if it does sound like an appropriate alternative or does it sound like someone trying to avoid the process of an installable software ? Also if it can be done, then Ideally what are the things that I should be taking care off ? and was really keen to know how many of you have come across situations like these and offered solutions like this if atall Thanks, Vinay Kannan.
[PHP-DB] PHP ERP Applications Need Suggestions????
*Hello everyone,* *I just want to develop a big ERP applications.Can anyone tell me which framework will be better for ERP (HR,Finance,Inventory,Production,Administration etc etc) means CakePHP,Codeigniter and also database PostgreSql or Mysql or shall i go with Core PHP? Thanks in advance Kindly do the reply my friends I -- Regards Mohamed Hashim.N Mobile:09894587678*
Re: [PHP-DB] PHP ERP Applications Need Suggestions????
Hello! You should look at same good stable ERP's PHP based, and start your new project from one of them. By example: * BlueErp * Dolibarr * GNU Enterprise * WebERP Cheers, Adriano Laranjeira. On Mon, 28 Jun 2010 17:17:26 +0530 Mohamed Hashim nmdhas...@gmail.com wrote: *Hello everyone,* *I just want to develop a big ERP applications.Can anyone tell me which framework will be better for ERP (HR,Finance,Inventory,Production,Administration etc etc) means CakePHP,Codeigniter and also database PostgreSql or Mysql or shall i go with Core PHP? Thanks in advance Kindly do the reply my friends I -- Regards Mohamed Hashim.N Mobile:09894587678* -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP / iODBC / PostGreSQL: running into a deadlock
Hi, I recently decided to setup my mac for some php developments. OS X 10.5 already ships with Apache, PHP and I chose PostGreSQL as DB server. I picked a package link from the official website and I installed it. The DB server is running smoothly. Now, as OS X's php module is not pgsql-enabled, I chose to take advantage of libiodbc (which php can handle). I installed psqlODBC driver. - testing with `iodbctest': the program finds libiodbc which in turns uses psqlODBC driver to connect to the database; I can issue SQL statements which succeed = OK - connecting php to libiodbc (note that I get the same results whether I use php module with Apache or the CLI): odbc_connect() works correctly, the DSN is found and I get a connection on PostgreSQL server. The problem arises when I try to use odbc_prepare(), odbc_exec(), etc. functions. I run into some kind of a deadlock which causes those functions to never end. I couldn't find any solution/description of this problem for Mac platform in Google. To try to solve this issue, I grabed the sources for PHP (5.3.2) and libiodbc (3.52.7). When ran under GDB, I can observe the following: odbc_exec() [PHP code] calls SQLAllocStmt() [libiodbc code], which calls some internal function that tries to call SQLAllocStmt(), in some indirect recursive way. As SQLAllocStmt() is protected by a mutex, there's a deadlock. The BT is as follows: #0 0x90529d85 in pthread_mutex_lock () #1 0x00bd6cec in SQLAllocStmt (hdbc=0x1016200, phstmt=0x1828034) at hstmt.c:427 #2 0x00bd667a in SQLAllocStmt_Internal (hdbc=0x1827940, phstmt=0xdc5cec) at hstmt.c:241 #3 0x00bd6db6 in SQLAllocStmt (hdbc=0x1827940, phstmt=0xdc5cec) at hstmt.c:430 #4 0x00238808 in zif_odbc_exec (ht=2, return_value=0xdc454c, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0) at /usr/local/php/src/5.3.2/ext/odbc/php_odbc.c:1551 #5 0x004d020d in zend_do_fcall_common_helper_SPEC (execute_data=0xf28040) at zend_vm_execute.h:313 #6 0x004d5815 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0xf28040) at zend_vm_execute.h:1603 #7 0x004cf346 in execute (op_array=0xdc5d38) at zend_vm_execute.h:104 #8 0x0049fec9 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/local/php/src/5.3.2/Zend/zend.c:1194 #9 0x004231f5 in php_execute_script (primary_file=0xb98c) at /usr/local/php/src/5.3.2/main/main.c:2260 #10 0x00578f7b in main (argc=2, argv=0xba84) at /usr/local/php/src/5.3.2/sapi/cli/php_cli.c:1192 Regarding why this doesn't occur with `iodbctest', the answer is that is simply doesn't call SQLAllocStmt(). It replaces this call with SQLAllocHandle(). Now, I'm wondering: - am I the only nut to try such setup on OS X (Apache, PHP, ODBC, Postgres)? - is that some configuration issue? - is that a problem either in PHP or libiodbc code? Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP / iODBC / PostGreSQL: running into a deadlock
To try to solve this issue, I grabed the sources for PHP (5.3.2) and libiodbc (3.52.7). When ran under GDB, I can observe the following: odbc_exec() [PHP code] calls SQLAllocStmt() [libiodbc code], which calls some internal function that tries to call SQLAllocStmt(), in some indirect recursive way. As SQLAllocStmt() is protected by a mutex, there's a deadlock. The BT is as follows: Probably best to ask on the php-internals list, they write the C code behind php so will be best able to help you. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php mysql comparing two rows in two columns for username and passwort
Hello, i am writing a small login script for a website. The username and passwort are stored in a database in two separate columns. I have it like this: while($dbbenutzer = mysql_fetch_row($sqlbenutzername)) while($dbpasswort = mysql_fetch_row($sqlpasswort)){ echo $dbbenutzer[$i]; echo $dbpasswort[$j]; if($benutzername == $dbbenutzer and $pass == $dbpasswort){ echo 'pSie haben sich erfolgreich angemeldet/p'; echo 'a href=willkommen.htmlWillkommen/a'; } } } Sice the values are entries in rows in two columns, i use mysql_fetch_row to get the entries. Then i want to compare the returned values of the sql statement with the values provided by the user. My problem now is only get the first value pair of username and passwort, not the second. For instance the first value pair is moritz 123456 which i get returned but i dont get returned the second value pair thomas thorr. thank you yours sincerly Alexander Schunk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort
Hi, Maybe try... $benutzername = $_GET['username']; $pass = $_GET['password']; $result = SELECT * FROM usertable WHERE sqlbenutzername='$benutzername'; while($r = mysql_fetch_row($result)) { $dbbenutzer = $r[sqlbenutzername]; $dbpasswort = $r[sqlpasswort]; } if($benutzername == $dbbenutzer $pass == $dbpasswort){ echo 'pSie haben sich erfolgreich angemeldet/p'; echo 'a href=willkommen.htmlWillkommen/a'; Karl On Apr 29, 2010, at 7:25 AM, Alexander Schunk wrote: Hello, i am writing a small login script for a website. The username and passwort are stored in a database in two separate columns. I have it like this: while($dbbenutzer = mysql_fetch_row($sqlbenutzername)) while($dbpasswort = mysql_fetch_row($sqlpasswort)){ echo $dbbenutzer[$i]; echo $dbpasswort[$j]; if($benutzername == $dbbenutzer and $pass == $dbpasswort){ echo 'pSie haben sich erfolgreich angemeldet/p'; echo 'a href=willkommen.htmlWillkommen/a'; } } } Sice the values are entries in rows in two columns, i use mysql_fetch_row to get the entries. Then i want to compare the returned values of the sql statement with the values provided by the user. My problem now is only get the first value pair of username and passwort, not the second. For instance the first value pair is moritz 123456 which i get returned but i dont get returned the second value pair thomas thorr. thank you yours sincerly Alexander Schunk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort
On 29 April 2010 15:00, Karl DeSaulniers k...@designdrumm.com wrote: Hi, Maybe try... $benutzername = $_GET['username']; $pass = $_GET['password']; $result = SELECT * FROM usertable WHERE sqlbenutzername='$benutzername'; Don't use values from $_GET without sanitizing first. If using mysql_* functions, sanitize with mysql_real_escape_string() first. while($r = mysql_fetch_row($result)) { $dbbenutzer = $r[sqlbenutzername]; $dbpasswort = $r[sqlpasswort]; } if($benutzername == $dbbenutzer $pass == $dbpasswort){ This would work but only if you're storing passwords in the database in clear text - which is a Bad Thing and should be avoided. Hash the passwords before storing and compare with a hashed version, not the cleartext. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort
Yes. You are correct. Did not include that part, sry. Dont forget mysql_real_escape_string. :) Karl On Apr 29, 2010, at 9:37 AM, Peter Lind wrote: On 29 April 2010 15:00, Karl DeSaulniers k...@designdrumm.com wrote: Hi, Maybe try... $benutzername = $_GET['username']; $pass = $_GET['password']; $result = SELECT * FROM usertable WHERE sqlbenutzername='$benutzername'; Don't use values from $_GET without sanitizing first. If using mysql_* functions, sanitize with mysql_real_escape_string() first. while($r = mysql_fetch_row($result)) { $dbbenutzer = $r[sqlbenutzername]; $dbpasswort = $r[sqlpasswort]; } if($benutzername == $dbbenutzer $pass == $dbpasswort){ This would work but only if you're storing passwords in the database in clear text - which is a Bad Thing and should be avoided. Hash the passwords before storing and compare with a hashed version, not the cleartext. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort
On 29 April 2010 16:44, Alexander Schunk asch...@gmail.com wrote: Hello, i have it now as follows: while($dbbenutzer = mysql_fetch_assoc($sqlbenutzername)) while($dbpasswort = mysql_fetch_assoc($sqlpasswort)){ You have things very twisted. Check the code posted by Karl - you only need *ONE* row containing your *TWO* fields. mysql_fetch_assoc() retrieves that *ONE* row from a MySQL result set as an array - so having those two while statements will do you no good. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php-db-unsubscr...@lists.php.net
php-db-unsubscr...@lists.php.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Objects and SQL Results
Hi, Why don't you just try the following: $query = SELECT * FROM foo WHERE UserID = .$uID . ORDER BY bar; $result = mysql_query($query); //get the first row $row = mysql_fetch_object($result); //get the next row while ($next = mysql_fetch_object($result)) { //do something with row/next //The next row is the current row in the next iteration $row = $next; } mysql_free_result($result); Regards Moritz On Fri, Feb 12, 2010 at 8:26 PM, Paul devine...@msn.com wrote: Hi all, I'm currently having a problem correctly formatting a table within a while loop. I'm using an object to store the results of a query, and using the while to iterate through it each row to produce the output: $query = SELECT * FROM foo WHERE UserID = .$uID . ORDER BY bar; $result = mysql_query($query); while($obj = mysql_fetch_object($result)) { $obj-bar; } To properly format the table, I need to check the value of bar in the next iteration of the object (but have to do it on the current one). Using an array, I would do: next($obj); if($obj[bar] == something) { //do things } prev($obj); Is there an equivalent to object? I've tried the above method, but nothing happens. I've also tried type casting it to an array, without success. Is there anyway to iterate through this? Thanks, Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Objects and SQL Results
On 12 February 2010 23:46, Paul Hollingworth devine...@msn.com wrote: Thanks for the code Eric, it seems to loosely provide the functionality that I'm after. Just out of interest though, is there no other way to find the next result row in an object apart from dumping it into an array? Thanks, Paul You can use mysql_result() (http://docs.php.net/manual/en/function.mysql-result.php) to read a specific row from the result set. But you could also use the SQL WHERE or LIMIT clause to only retrieve the specific row or rows you wanted. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP Objects and SQL Results
Hi all, I'm currently having a problem correctly formatting a table within a while loop. I'm using an object to store the results of a query, and using the while to iterate through it each row to produce the output: $query = SELECT * FROM foo WHERE UserID = .$uID . ORDER BY bar; $result = mysql_query($query); while($obj = mysql_fetch_object($result)) { $obj-bar; } To properly format the table, I need to check the value of bar in the next iteration of the object (but have to do it on the current one). Using an array, I would do: next($obj); if($obj[bar] == something) { //do things } prev($obj); Is there an equivalent to object? I've tried the above method, but nothing happens. I've also tried type casting it to an array, without success. Is there anyway to iterate through this? Thanks, Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Objects and SQL Results
On Sat, Feb 13, 2010 at 3:26 AM, Paul devine...@msn.com wrote: Hi all, I'm currently having a problem correctly formatting a table within a while loop. I'm using an object to store the results of a query, and using the while to iterate through it each row to produce the output: $query = SELECT * FROM foo WHERE UserID = .$uID . ORDER BY bar; $result = mysql_query($query); while($obj = mysql_fetch_object($result)) { $obj-bar; } To properly format the table, I need to check the value of bar in the next iteration of the object (but have to do it on the current one). Using an array, I would do: next($obj); if($obj[bar] == something) { //do things } prev($obj); Is there an equivalent to object? I've tried the above method, but nothing happens. I've also tried type casting it to an array, without success. Is there anyway to iterate through this? Paul Is this the one you want ? $sql = 'select id, name from test'; $result = mysql_query($sql); $rows = array(); $row = null; while ($row = mysql_fetch_object($result)) { $rows[] = $row; } reset($rows); for ($i = 0, $c = sizeof($rows) - 1; $i $c; $i++) { next($rows); if (current($rows)-name) { // something to do } prev($rows); echo current($rows)-id, ' ', current($rows)-name, \n; next($rows); } if (current($rows)) { echo current($rows)-id, ' ', current($rows)-name, \n; } Regards, Eric, Thanks, Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Objects and SQL Results
Thanks for the code Eric, it seems to loosely provide the functionality that I'm after. Just out of interest though, is there no other way to find the next result row in an object apart from dumping it into an array? Thanks, Paul Eric Lee wrote: On Sat, Feb 13, 2010 at 3:26 AM, Paul devine...@msn.com wrote: Hi all, I'm currently having a problem correctly formatting a table within a while loop. I'm using an object to store the results of a query, and using the while to iterate through it each row to produce the output: $query = SELECT * FROM foo WHERE UserID = .$uID . ORDER BY bar; $result = mysql_query($query); while($obj = mysql_fetch_object($result)) { $obj-bar; } To properly format the table, I need to check the value of bar in the next iteration of the object (but have to do it on the current one). Using an array, I would do: next($obj); if($obj[bar] == something) { //do things } prev($obj); Is there an equivalent to object? I've tried the above method, but nothing happens. I've also tried type casting it to an array, without success. Is there anyway to iterate through this? Paul Is this the one you want ? $sql = 'select id, name from test'; $result = mysql_query($sql); $rows = array(); $row = null; while ($row = mysql_fetch_object($result)) { $rows[] = $row; } reset($rows); for ($i = 0, $c = sizeof($rows) - 1; $i $c; $i++) { next($rows); if (current($rows)-name) { // something to do } prev($rows); echo current($rows)-id, ' ', current($rows)-name, \n; next($rows); } if (current($rows)) { echo current($rows)-id, ' ', current($rows)-name, \n; } Regards, Eric, Thanks, Paul -- 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] PHP Objects and SQL Results
Hi Paul, Can't you just? $query = SELECT DISTINCT bar FROM foo WHERE UserID = .$uID; $result = mysql_query($query); while($obj = mysql_fetch_assoc($result) { $bar = $obj['bar']; if ($bar == something) { //do this } } I'm some what a beginner, so sorry if this wastes your time. Karl On Feb 12, 2010, at 1:26 PM, Paul wrote: Hi all, I'm currently having a problem correctly formatting a table within a while loop. I'm using an object to store the results of a query, and using the while to iterate through it each row to produce the output: $query = SELECT * FROM foo WHERE UserID = .$uID . ORDER BY bar; $result = mysql_query($query); while($obj = mysql_fetch_object($result)) { $obj-bar; } To properly format the table, I need to check the value of bar in the next iteration of the object (but have to do it on the current one). Using an array, I would do: next($obj); if($obj[bar] == something) { //do things } prev($obj); Is there an equivalent to object? I've tried the above method, but nothing happens. I've also tried type casting it to an array, without success. Is there anyway to iterate through this? Thanks, Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com
Re: [PHP-DB] PHP Objects and SQL Results
On Sat, Feb 13, 2010 at 7:46 AM, Paul Hollingworth devine...@msn.comwrote: Thanks for the code Eric, it seems to loosely provide the functionality that I'm after. Just out of interest though, is there no other way to find the next result row in an object apart from dumping it into an array? Paul Apologize ! I think no. The resource returned by mysql_query acts like a pointer (or cursor on database side) that point to the current record in result set. Before it is able advanced to the next the record must retrieved first. Might some design patterns be help for your situation. And wait for some php pros that master in this area. Regards, Eric Thanks, Paul Eric Lee wrote: On Sat, Feb 13, 2010 at 3:26 AM, Paul devine...@msn.com wrote: Hi all, I'm currently having a problem correctly formatting a table within a while loop. I'm using an object to store the results of a query, and using the while to iterate through it each row to produce the output: $query = SELECT * FROM foo WHERE UserID = .$uID . ORDER BY bar; $result = mysql_query($query); while($obj = mysql_fetch_object($result)) { $obj-bar; } To properly format the table, I need to check the value of bar in the next iteration of the object (but have to do it on the current one). Using an array, I would do: next($obj); if($obj[bar] == something) { //do things } prev($obj); Is there an equivalent to object? I've tried the above method, but nothing happens. I've also tried type casting it to an array, without success. Is there anyway to iterate through this? Paul Is this the one you want ? $sql = 'select id, name from test'; $result = mysql_query($sql); $rows = array(); $row = null; while ($row = mysql_fetch_object($result)) { $rows[] = $row; } reset($rows); for ($i = 0, $c = sizeof($rows) - 1; $i $c; $i++) { next($rows); if (current($rows)-name) { // something to do } prev($rows); echo current($rows)-id, ' ', current($rows)-name, \n; next($rows); } if (current($rows)) { echo current($rows)-id, ' ', current($rows)-name, \n; } Regards, Eric, Thanks, Paul -- 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] php, session_set_save_handler disappearing session vars
I have used session classes before and am at a loss as to why I cannot for the life of me get this to work... Any help is appreciated. I might just be confused with the database connection handles in order to pull and store session information as there was some information posted on php.net referencing some changes between php4 and php5 in regards to passing a database connection handle to a custom session handler class. However as you can see from the class here it initializes a database connection handle for each function call to *hopefully eliminate this problem. I do appreciate help on this. Thanks. First the db sessions table: CREATE TABLE IF NOT EXISTS `admin_sessions` ( `session_id` varchar(32) NOT NULL default '', `http_user_agent` varchar(32) NOT NULL default '', `session_data` blob NOT NULL, `session_expire` int(11) NOT NULL default '0', PRIMARY KEY (`session_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Pretty simple right? Now here is my dbSessions class (complete with debugging statements: class dbSession { private $data; private $max_time; private $dbconn; public function __construct( $max_time ) { //@register_shutdown_function( 'session_write_close' ); if( !empty( $max_time ) ) { @ini_set( 'session.gc_maxlifetime', $max_time ); } else { @ini_set( 'session.gc_maxlifetime', 3600 ); } session_set_save_handler( array( $this, 'open' ), array( $this, 'close' ), array( $this, 'read' ), array( $this, 'write' ), array( $this, 'destroy' ), array( $this, 'gc' ) ); //@ini_set('session.gc_probability', 50); //@ini_set('session.save_handler', 'user'); @register_shutdown_function( 'session_write_close' ); @session_start(); } public function register( $name, $data ) { return $_SESSION[$name] = $data; } public function open( $path, $name ) { echo OPEN CALLEDBR; global $defined; global $handles; if( ( $this-dbconn = $handles['db']-dbConnect( $defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname'] ) ) !== -1 ) { return true;//$this-dbconn; } else { return false; } } public function close() { echo CLOSE CALLEDBR; global $defined; global $handles; // clean up data $handles['misc']-CleanUpVars( $_SESSION, NULL ); // Perform analyze, repair and optimize on used tables $handles['db']-dbFixTable( admin_sessions, $this-dbconn ); // Free db handle and close connection(s) $handles['db']-dbFreeData( $this-dbconn ); $handles['db']-dbCloseConn( $this-dbconn ); return true; } public function read( $id ) { echo READ CALLEDBR; echo pre; var_dump( print_r( func_get_args() ) ); echo /pre; global $handles; global $defined; $this-dbconn = $handles['db']-dbConnect( $defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname'] ); $query = SELECT `session_data` FROM `admin_sessions` WHERE `session_id` = \ . $id . \ AND `http_user_agent` = \ . md5( $_SERVER[HTTP_USER_AGENT] ) . \ LIMIT 1; $result = $handles['db']-dbQuery( $handles['val']-ValidateSQL( $query, $this-dbconn ), $this-dbconn ); echo RAN: . $query . = . $handles['db']-dbNumRowsAffected( $this-dbconn ) . br; if( ( is_resource( $result ) ) ( $handles['db']-dbNumRowsAffected( $this-dbconn ) 0 ) ) { $fields = $handles['db']-dbArrayResultsAssoc( $result ); echo FOUND EXISTING SESSION DATA: . print_r( $fields['session_data'] ) . br; return stripslashes( $fields['session_data'] ); } echo NOTHING FOUND FOR: . $id . br; return ; } public function write( $id, $data ) { echo WRITE CALLEDBR; echo pre; var_dump( print_r( func_get_args() ) ); echo /pre; global $handles; global $defined; $this-dbconn = $handles['db']-dbConnect( $defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname'] ); $query = SELECT `session_data` FROM `admin_sessions` WHERE `session_id` = \ . $id . \ AND `http_user_agent` = \ . md5( $_SERVER[HTTP_USER_AGENT] ) . \ LIMIT 1; $result = $handles['db']-dbQuery( $handles['val']-ValidateSQL( $query, $this-dbconn ), $this-dbconn ); //$data = $handles['db']-dbArrayResultsAssoc( $result ); //echo pre; print_r( $data ); echo /pre; if( ( is_resource( $result ) ) ( $handles['db']-dbNumRowsAffected( $result ) 0 ) ) { $query = UPDATE `admin_sessions` SET `session_data` = \ . mysql_real_escape_string( $data ) . \, `session_expire` = \ . time() . \ WHERE `session_id` = \ . $id . \ LIMIT 1; } else { $query = INSERT INTO `admin_sessions` ( `session_id`, `http_user_agent`, `session_data`, `session_expire` ) VALUES ( \ . $id . \, \ . md5( $_SERVER[HTTP_USER_AGENT] ) . \, \ . mysql_real_escape_string( $data ) . \, \ . time() . \ ) ON DUPLICATE KEY UPDATE `session_data` = \ . mysql_real_escape_string( $data ) . \, `session_expire` = \ . time() . \; } $result = $handles['db']-dbQuery( $handles['val']-ValidateSQL( $query, $this-dbconn ), $this-dbconn ); echo RAN: . $query . = . $handles['db']-dbQuery( $handles['val']-ValidateSQL(
[PHP-DB] PHP Help with pagination
Hey nagendra, I tried to post this a while ago, but it may be too long for the list. ?php if ($Submit) { // perform search only if correct form was entered. $db = mysql_connect ($Host, $User, $Password); mysql_select_db ($DBName) or die (Cannot connect to database); //check if the starting row variable was passed in the URL or not if (!isset($_GET['pg']) or !is_numeric($_GET['pg'])) { //we give the value of the starting row to 1 because this is the first page $pg = 1; //otherwise we take the value from the URL } else { $pg = $_GET['pg']; } ? ?php // I used the results from a dropdown menu for the users selection from the previous page that called this one. if ($fieldTwentyOne == 'All Users Last Login Date') { $fieldTwentyOne = %; } $srch=%.$Submit.%; ? ?php /// Variables $max_results = 5; /// Number of results per page $min = (($pg * $max_results) - $max_results); ? ?php /// Count total $query_total_users = SELECT COUNT(*) as Num FROM users; $totals = mysql_result(mysql_query($query_total_users, $db),0); $total_pgs = ceil($totals / $max_results); ? ?php $query_UserLastLogin = SELECT * FROM users WHERE UserLastLogin LIKE '$fieldTwentyOne' ; $UserLastLogin = mysql_query($query_UserLastLogin, $db) or die (mysql_error()); if(!get_magic_quotes_gpc()) { $UserLastLogin = stripslashes ($UserLastLogin); } $row_UserLastLogin = mysql_fetch_assoc($UserLastLogin); ? ?php /// Page limiter result builder // Access table properties $query_users = SELECT * FROM users LIMIT $min, $max_results; $result = mysql_query($query_users, $db) or die(mysql_error()); $num_sql = mysql_numrows($result); if ($result) { // Build paging if($pg 1) { $prev = ($pg - 1); // Previous Link $paging = a href='.$_SERVER['PHP_SELF'].?Submit=.$Submit.pg=. $prev.'Previous pagenbsp;/a; //$paging = a href=\{$_SERVER['PHP_SELF']}?pg=$prev\Previous page/a; } for($j = 1; $j = $total_pgs; $j++) { /// Numbers $paging .= a href='.$_SERVER['PHP_SELF'].?Submit=. $Submit.pg=.$j.'nbsp;.$j.nbsp;/a; //$paging .= a href=\{$_SERVER['PHP_SELF']}?pg=$ij\$j/a ; }} } if($pg $total_pgs) { $next = ($pg + 1); // Next Link $paging .= a href='.$_SERVER['PHP_SELF'].?Submit=. $Submit.pg=.$next.'nbsp;Next page/a; } ? // In my html I have a table cel displaying info For the page numbers: td colspan=22 width=90% align=left valign=top bgcolor=#5E5E5Efont size=2 face=Verdana, Arial, Helvetica, sans-serifnbsp;nbsp;p align=left?php echo $paging?/p/td For showing current page and database totals: td colspan=22 width=10% align=left valign=bottom bgcolor=#5E5E5Efont size=2 face=Verdana, Arial, Helvetica, sans-serifHere are the results:brNum_sql Rows: ?php echo $num_sql?brNumber of Users: ?php echo $totals?brTotal Pages: ? php echo $total_pgs?brNumber of Results: ?php echo $totals? brViewing page ?php echo $pg? of ?php echo $total_pgs?br/td Then I close the html and php ?php } // End if($Submit) ? Use this if you want, I took bits and pieces and put this together for you, but hope that helps. Karl DeSaulniers Design Drumm http://designdrumm.com
[PHP-DB] PHP and MYSQL Update problem
Hello, I have a little problem with a sql command string $q = UPDATE episodes SET episode_title = '$_POST[episode_title]' , episode_scheduleddate = .strtotime($_POST['episode_scheduleddate']). , episode_description = '$_POST[episode_description]' WHERE episode_id = $_POST[episode_id]; I keep getting this error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' which doesn't help a lot. I've already tried to print the result UPDATE episodes SET episode_title = 'Title test 1 edited 2' , episode_scheduleddate = 1232427600 , episode_description = 'Description test edited' WHERE episode_id = 1 I really can't find the problem. I tried almost every combination with ' and without any result. Thank you. Simon. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP and MYSQL Update problem
try .. $q = addslashes(UPDATE episodes SET episode_title = '$_POST[episode_title]' , episode_scheduleddate = .strtotime($_POST['episode_scheduleddate']). , episode_description = '$_POST[episode_description]' WHERE episode_id = $_POST[episode_id]); or try $q = UPDATE episodes SET episode_title = '{$_POST[episode_title]}' , episode_scheduleddate = {.strtotime($_POST['episode_scheduleddate'])}. , episode_description = '{$_POST[episode_description]}' WHERE episode_id = {$_POST[episode_id]}; On Tue, Jan 26, 2010 at 10:51 PM, Simone Fornara simone.forn...@gmail.comwrote: Hello, I have a little problem with a sql command string $q = UPDATE episodes SET episode_title = '$_POST[episode_title]' , episode_scheduleddate = .strtotime($_POST['episode_scheduleddate']). , episode_description = '$_POST[episode_description]' WHERE episode_id = $_POST[episode_id]; I keep getting this error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' which doesn't help a lot. I've already tried to print the result UPDATE episodes SET episode_title = 'Title test 1 edited 2' , episode_scheduleddate = 1232427600 , episode_description = 'Description test edited' WHERE episode_id = 1 I really can't find the problem. I tried almost every combination with ' and without any result. Thank you. Simon. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Regards MANU
Re: [PHP-DB] PHP and MYSQL Update problem
Manu Gupta wrote: try .. $q = addslashes(UPDATE episodes SET episode_title = '$_POST[episode_title]' , episode_scheduleddate = .strtotime($_POST['episode_scheduleddate']). , episode_description = '$_POST[episode_description]' WHERE episode_id = $_POST[episode_id]); or try $q = UPDATE episodes SET episode_title = '{$_POST[episode_title]}' , episode_scheduleddate = {.strtotime($_POST['episode_scheduleddate'])}. , episode_description = '{$_POST[episode_description]}' WHERE episode_id = {$_POST[episode_id]}; Good idea but you don't addslashes the whole query (and addslashes is the wrong thing to use). Use mysql_real_escape_string around bits and pieces you want to escape: $q = update episodes set episode_title=' . mysql_real_escape_string($_POST['episode_title']) . ', .. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Update query
$query = UPDATE `clients` SET `company` = '$company', `contact` = '$contact', `phone` = '$phone', `city` = '$city' WHERE `clients`.`reference` =$client LIMIT 1; $client_result=mysql_query($query); // now check for errors mysql_error() mysql_errno() Sudheer Satyanarayana wrote: On Tuesday 03 November 2009 11:29 AM, Ron Piggott wrote: How do I test if an UPDATE query worked $query = UPDATE `clients` SET `company` = '$company', `contact` = '$contact', `phone` = '$phone', `city` = '$city' WHERE `clients`.`reference` =$client LIMIT 1; $client_result=mysql_query($query); ??? Ron From the manual page: For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, *mysql_query()* returns *TRUE* on success or *FALSE* on error. If $client_result == true you know the query was successful. -- Jason Gerfen Systems Administration/Web application development jason.ger...@scl.utah.edu Marriott Library Lab Systems PC 295 South 1500 East Salt Lake City, Utah 84112-0806 Ext 5-9810 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP Update query
How do I test if an UPDATE query worked $query = UPDATE `clients` SET `company` = '$company', `contact` = '$contact', `phone` = '$phone', `city` = '$city' WHERE `clients`.`reference` =$client LIMIT 1; $client_result=mysql_query($query); ??? Ron
Re: [PHP-DB] PHP Update query
Ron Piggott wrote: How do I test if an UPDATE query worked $query = UPDATE `clients` SET `company` = '$company', `contact` = '$contact', `phone` = '$phone', `city` = '$city' WHERE `clients`.`reference` =$client LIMIT 1; $client_result=mysql_query($query); ??? http://www.php.net/manual/en/function.mysql-affected-rows.php If it returns 0 that could mean: - no row was originally found with that condition or - no update was performed (the data stayed the same) -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Update query
Hi Ron, Have a look at http://www.php.net/manual/en/function.mysql-info.php - Original Message - From: Ron Piggott ron@actsministries.org To: PHP DB php-db@lists.php.net Sent: Monday, November 02, 2009 11:59 PM Subject: [PHP-DB] PHP Update query How do I test if an UPDATE query worked $query = UPDATE `clients` SET `company` = '$company', `contact` = '$contact', `phone` = '$phone', `city` = '$city' WHERE `clients`.`reference` =$client LIMIT 1; $client_result=mysql_query($query); ??? Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Update query
On Tuesday 03 November 2009 11:29 AM, Ron Piggott wrote: How do I test if an UPDATE query worked $query = UPDATE `clients` SET `company` = '$company', `contact` = '$contact', `phone` = '$phone', `city` = '$city' WHERE `clients`.`reference` =$client LIMIT 1; $client_result=mysql_query($query); ??? Ron From the manual page: For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, *mysql_query()* returns *TRUE* on success or *FALSE* on error. If $client_result == true you know the query was successful. -- With warm regards, Sudheer. S Tech stuff: http://techchorus.net Business: http://binaryvibes.co.in -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP stored within mySQL table
I am working on a shopping cart ... specifically writing about the delivery time lines. I thought I would include the information pages (like store policies, contact us, about us) for my shopping cart within a mysql table. But I ran into a challenge when I got to the Delivery time line details. I would like to use PHP to calculate when the expected arrival date will be. This means storing the information pages in PHP code and using the eval command. $one_week = strtotime(+7 days); $one_week = date('Y-m-d', $one_week); $two_weeks = strtotime(+14 days); $two_weeks = date('Y-m-d', $two_weeks); $six_weeks = strtotime(+42 days); $six_weeks = date('Y-m-d', $six_weeks); The specific problem I am not sure how to resolve is with the CSS rules. I haven't figured out how to resolve the parse error the eval command is giving me for the following line of code: echo ul class=\lists\\r\n; The rest of what I am write for the delivery looks like this: === echo h3Delivery Details/h3\r\n; echo pThe following are our approximate bdelivery time lines/b:/p\r\n; echo ul class=\lists\\r\n; echo liTo Canada: One Week ($one_week)/li\r\n; echo liTo United States: Two Weeks ($two_weeks)/li\r\n; echo liTo Overseas: Up To Six Weeks ($six_weeks)/li\r\n; echo /ul\r\n; === Does anyone have a suggestion for me? Should I be putting the store policies into their own files instead of using the database and the eval command? How have you approached similar situations? Ron
[PHP-DB] PHP on Pear
Hello, I've been programming on PHP for almost a year now, many examples that I've gone through or some of the reference books that I've read and many websites which show examples of PHP pgramming seem to be using PEAR package, and I've never used PEAR or any other Package, I was wondering whats the advantage of using PEAR instead of the using PHP directly in the code or maybe even creating our own functions in PHP. I am really confused about this now, earlier I used to neglect these things, but now I curious and getting a little impatient coz I am starting some work on a project for myself, and I would want to keep changing the code all the time. Can someone guide me on this please? Thanks, Vinay Kannan.
Re: [PHP-DB] PHP on Pear
Vinay Kannan wrote: Hello, I've been programming on PHP for almost a year now, many examples that I've gone through or some of the reference books that I've read and many websites which show examples of PHP pgramming seem to be using PEAR package, and I've never used PEAR or any other Package, I was wondering whats the advantage of using PEAR instead of the using PHP directly in the code or maybe even creating our own functions in PHP. Pear is reusable code and a package has been tested with a variety of websites using it. They have documentation, it's clear and concise. Most of the time they will also handle errors you haven't thought of (because a package has been tested so much). They are also designed to run on any system and have no hardcoded assumptions. They also have quality control measures in place so packages have to live up to a high standard to be included. Check out the list of packages available: http://pear.php.net/packages.php The only package that should replicate php functions is the 'PHP_Compat' package to provide older php versions with new functions. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP output in the mySQL table
I am wondering if I can put PHP into a mySQL table. When I tried doing: echo stripslashes(mysql_result($article_titles_result,0,article)); The PHP coding displays, not rendered PHP. Any suggestions? Ron
Re: [PHP-DB] PHP output in the mySQL table
Ron Piggott wrote: I am wondering if I can put PHP into a mySQL table. When I tried doing: echo stripslashes(mysql_result($article_titles_result,0,article)); The PHP coding displays, not rendered PHP. You'd need to 'eval' it (http://www.php.net/eval), though be very careful as any php code will be executed. This means something like 'include http://www.example.com/evilscript.php' will be executed if an attacker is able to get it into your database through whatever means. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php mysql calendar
Hello list Can someone suggest me a php mysql calender, easy configurable for special needs? I found some googling but the most of them query records form a specific table and its impossible to change the sql query. Thank you in advance Nikos
[PHP-DB] PHP won't return any records
Everyone, I have never used the PHP mssql functions before, I am versed in MySql instead, I cannot get the following code to return any records. The variables $dbserver, $dbuser, $dbpasswd are defined in a config file and are being read and the connection is being made because I can change any one of the variables to a incorrect value and mssql_connect fails. When I use TDS Version 8.0 I get back the Resource ID # only. ?php $linkID = mssql_connect($dbserver, $dbuser, $dbpasswd); if(!$linkID) { die('There was an error while attempting to connect to the MSSQL Server'); } if(!$linkID || !mssql_select_db($database, $linkID)) { die('Unable to connect or select database!'); } //The following is for debugging $query = SELECT * FROM pohdr WHERE ponum = '136025'; echo $query; print BR; print BR; $data = mssql_query($query, $linkID) or die ('Query failed: '.$query); $result = array(); echo $data; do { while ($row = mssql_fetch_row($data)){ $result[] = $row; } }while ( mssql_next_result($data) ); // Clean up mssql_free_result($data); mssql_close($linkID); include ('common/footer.php'); ? My environment: Server #1 - 100% CentOS RPM installed CentOS 5.3 Apache 2.2.3 PHP 5.1.6 FreeTDS 0.64 Server #2 Microsoft Server 2003 Enterprise Edition SQL Server 2005 SQL Server 2000 Compatibility Tools installed Server #3 - Compiled from Source CentOS 5.3 Apache 2.2.11 PHP 5.2.10 (also tried 5.2.5, 5.1.6 and 4.4.7) FreeTDS 0.82 By setting the TDS Version to 8.0 on either Server #1 or Server #2 I can make a connection to the SQL Server using tsql -S {servername} -U {username} and execute the SQL Query above and the records are returned. If I set the TDS Version to 9.0 I can make a connection to the SQL server but from 0.64 or 0.82 I get this error Msg 4004, Level 16, State 1, Server {servername}, Line 1 Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. when I use the SQL Query above. Any assistance would be greatly appreciated. Best, Steve -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP- Mysql problem
Daniel, Now that is just funny stuff... Have you tried http://lmgtfy.com/?q=access+denied+for+user+odbc+localhost or the newer http://www.lmbify.com/search.php?s=access+denied+for+user+odbc+localhost Daniel Brown danbr...@php.net wrote in message news:ab5568160906180636r239f214eh7e4871da7139c...@mail.gmail.com... On Thu, Jun 18, 2009 at 06:03, NADARAJAH SIVASUTHAN NADARAJAHnsivasut...@live.com wrote: Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285 http://google.com/search?q=Access%20denied%20for%20user%20'ODBC'@'localhost'%20(using%20password:%20NO) http://fart.ly/dm6m7 -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP-Extension for Cego database
Hi folks, since I am providing an opensource dbms called cego ( more information about cego on my home page www.lemke-it.com ), I am interested in the integration of the database into PHP. Is there anyone out there who can support this and give me some hints ? Thanks in advance for any comment ! Best regards, Björn Lemke -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP-Extension for Cego database
GOOD afternon,to alll I am new to php,mysql i want to create user login account in a page please help me ,,, _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
[PHP-DB] PHP- Mysql problem
Dear all, When I try to retrive data from two tables using JOIN OR INNER JOIN it display error message given below; Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\ap_v5\inc\profile.inc.php on line 288 what may be the reason? Normally PHP-mysql works fine. Can you figure it out and give me the possible solution? Thank you. suthan _ Windows Live™: Keep your life in sync. Check it out! http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009
Re: [PHP-DB] PHP-Extension for Cego database
On Thu, Jun 18, 2009 at 2:00 AM, Bjoern Lemkele...@lemke-it.com wrote: Hi folks, since I am providing an opensource dbms called cego ( more information about cego on my home page www.lemke-it.com ), I am interested in the integration of the database into PHP. Is there anyone out there who can support this and give me some hints ? Thanks in advance for any comment ! Best regards, Björn Lemke -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php odbc is likely the best way to establish the connection -- Bastien Cat, the other other white meat -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP- Mysql problem
On Thu, Jun 18, 2009 at 6:03 AM, NADARAJAH SIVASUTHAN NADARAJAHnsivasut...@live.com wrote: Dear all, When I try to retrive data from two tables using JOIN OR INNER JOIN it display error message given below; Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\ap_v5\inc\profile.inc.php on line 288 what may be the reason? Normally PHP-mysql works fine. Can you figure it out and give me the possible solution? Thank you. suthan _ Windows Live™: Keep your life in sync. Check it out! http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009 The db user account that you are attempting the connection with does not have access to the db. Check the account details -- Bastien Cat, the other other white meat -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP- Mysql problem
On Thu, Jun 18, 2009 at 06:03, NADARAJAH SIVASUTHAN NADARAJAHnsivasut...@live.com wrote: Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285 http://google.com/search?q=Access%20denied%20for%20user%20'ODBC'@'localhost'%20(using%20password:%20NO) http://fart.ly/dm6m7 -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php 5.2.9 and Postgres 8.3.7
Hello, I tried all day yesterday to setup a brand new machine with a fresh Linux install; with apache 2.2.10 (from source) php 5.2.9 (from source) and PostgresQL 8.3.7 (from the very neat one-click installer provided by Enterprisedb) ; everything compiles and installs fine but when trying to run the first query to my database I consistently get a message about pg_escape_string function missing. I am connecting through ADODB which filters any query via '.pg_escape_string($this-_connectionID,$s).'; I had no problem using the same build with php 5.2.8 and Postgres 8.3.4, so I ended up using the mod_php5.so module for apache build with these versions, but would like to get to the bottom of it. Any idea or comment ? Didier -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php 5.2.9 and Postgres 8.3.7
Do you have postgres module for PHP installed? This will probably be the cause. Didier Gasser-Morlay napsal(a): Hello, I tried all day yesterday to setup a brand new machine with a fresh Linux install; with apache 2.2.10 (from source) php 5.2.9 (from source) and PostgresQL 8.3.7 (from the very neat one-click installer provided by Enterprisedb) ; everything compiles and installs fine but when trying to run the first query to my database I consistently get a message about pg_escape_string function missing. I am connecting through ADODB which filters any query via '.pg_escape_string($this-_connectionID,$s).'; I had no problem using the same build with php 5.2.8 and Postgres 8.3.4, so I ended up using the mod_php5.so module for apache build with these versions, but would like to get to the bottom of it. Any idea or comment ? Didier -- S pozdravem Daniel Tlach Freelance webdeveloper Email: m...@danaketh.com ICQ: 160914875 MSN: danak...@hotmail.com Jabber: danak...@jabbim.cz -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php 5.2.9 and Postgres 8.3.7
Lester, Sorry, I should have said: Yes: Postgres is up running happily on the machine yes : Postgres is listed in phpinfo; with the correct version; php was connecting fine to the dababase, this message only happens on the 1st query which is when the function pg_escape_string is called. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php 5.2.9 and Postgres 8.3.7
Lester, Sorry, I should have said: Yes: Postgres is up running happily on the machine yes : Postgres is listed in phpinfo; with the correct version; php was connecting fine to the dababase, this message only happens on the 1st query which is when the function pg_escape_string is called. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php and mysql image script
I need a simple php mysql image upload script with display script too and to make this easier the mysql database table to use
Re: [PHP-DB] php and mysql image script
On Thu, May 28, 2009 at 4:19 PM, Wilson Osemeilu engrwi...@yahoo.comwrote: I need a simple php mysql image upload script with display script too and to make this easier the mysql database table to use STFW -- Bastien Cat, the other other white meat
Re: [PHP-DB] PHP Postgres - query not writing to database.
I have copied the queries into psql and wrapped them in a BEGIN and COMMIT. Even from psql the queries appear to work but don't store the information. There don't appear to be errors in the log either. Thanks for your help, Carol km_tezt=# begin; BEGIN km_tezt=# INSERT INTO tblPeople(fName,mName,lName, ivlweb, cnsweb) VALU ES ('Frank', 'D',' Oz', 't', 't'); INSERT 0 1 km_tezt=# INSERT INTO tblContactInformation(contactItem,contactType) VALU ES ('f...@indiana.edu','0010'); INSERT 0 1 km_tezt=# INSERT INTO brdgPeopleContactInformation (peopleId,contactInform ationId,rank, type) VALUES (currval('tblPeople_peopleId_seq'),currval('tblC ontactInformation_contactInformationId_seq'), '1', '100'); INSERT 0 1 km_tezt=# commit; COMMIT km_tezt=# select * from tblPeople where lName like 'O%'; peopleId | fName | mName | lName | ivlweb | cnsweb --+-+---+++ 404 | Ilka| | Ott| t | t 410 | Elinor | | Ostrom | t | t 374 | Gregory | | O'Hare | t | t 33 | Terry | J.| Ord| t | t (4 rows) On May 10, 2009, at 4:41 AM, danaketh wrote: I'd suggest you to copy the echoed queries and run them directly in terminal (if you have access). Also if you have remote access to the database and can use tools like pgAdmin or Navicat, that could help you with testing. Or send me the table structure and I'll try them myself ;) Carol Walter napsal(a): Hello, I have a PHP program that contains a number of postgres queries. At the end of the program, it needs to write data to a database. You can see the code that I'm using below. I have die clauses on all the queries and I have the program echoing the queries that it runs to the screen. The die clause does not execute. The queries are echoed to the screen, but nothing is being written to the database. There don't appear to be any errors in the postgres log or the php log. Is there a function that I can use that will tell me exactly what is going on here? If there is, can you give me the syntax? Thanks in advance for your time. Carol P.S. This PHP 5 and PostgreSQL 8.3.6 on Solaris 10. ++ I've written a query that needs to insert data into two base tables and a bridge table. The code looks like... /* Echo data for database to the screen */ echop Contact Locator: $cont_loc/p; echop Contact Type Rank: $cont_rank/p; echop Contact Info Type: $contact_type/p; echop New name string: $f_name_new/p; echop New name string: $m_name_new/p; echop New name string: $l_name_new/p; echop New ivl web string: $ivl_web_peop/p; echop New cns_web string: $cns_web_peop/p; echop New contact rank string: $cont_rank/p; echop New contact locator string: $cont_loc/p; echop New contact item string: $contact_info1/p; echop New contact type string: $contact_type/p; /* Connect to database*/ include connect_km_tezt.php; /* Run queries*/ $query = INSERT INTO \tblPeople\(\fName\,\mName\, \lName\, ivlweb, cnsweb) VALUES ('$f_name_new', '$m_name_new',' $l_name_new', '$ivl_web_peop', '$cns_web_peop'); echo First query: . $query . br /; $pg_peop_ins = pg_query($query) or die(Can't execute first query); // echo pg_last_error(Last Error . $pg_peop_ins); //echo pg_result_error($pg_peop_ins); $query = INSERT INTO \tblContactInformation \(\contactItem\,\contactType\) VALUES ('$contact_info1','$contact_type'); echo Second query: . $query . br /; $pg_contact_ins = pg_query($query) or die(Can't execute 2nd query); $query = INSERT INTO \brdgPeopleContactInformation\ (\peopleId\, \contactInformationId\,rank, type) VALUES (currval('\tblPeople_peopleId_seq \'),currval('\tblContactInformation_contactInformationId_seq\'), '$cont_rank', '$cont_loc'); echo Third query: . $query . br /; $pg_peop_cont_ins = pg_query($query) or die(Can't execute 3rd query); + The postgres log looks like this ... [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]STATEMENT: INSERT INTO tblPeople(fName,mName,lName, ivlweb, cnsweb) VALUES ('Frank', 'D',' Oz', 't', 't') [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: duration: 105.005 ms [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: PLANNER STATISTICS
Re: [PHP-DB] PHP Postgres - query not writing to database.
To all who helped. Thank you very much. I found the problem. There is a leading blank on the last name field that I couldn't see. It was coming from my program code. Thanks for all your help. Carol On May 11, 2009, at 4:23 PM, Carol Walter wrote: I have copied the queries into psql and wrapped them in a BEGIN and COMMIT. Even from psql the queries appear to work but don't store the information. There don't appear to be errors in the log either. Thanks for your help, Carol km_tezt=# begin; BEGIN km_tezt=# INSERT INTO tblPeople(fName,mName,lName, ivlweb, cnsweb) VALU ES ('Frank', 'D',' Oz', 't', 't'); INSERT 0 1 km_tezt=# INSERT INTO tblContactInformation(contactItem,contactType) VALU ES ('f...@indiana.edu','0010'); INSERT 0 1 km_tezt=# INSERT INTO brdgPeopleContactInformation (peopleId,contactInform ationId,rank, type) VALUES (currval('tblPeople_peopleId_seq'),currval('tblC ontactInformation_contactInformationId_seq'), '1', '100'); INSERT 0 1 km_tezt=# commit; COMMIT km_tezt=# select * from tblPeople where lName like 'O%'; peopleId | fName | mName | lName | ivlweb | cnsweb --+-+---+++ 404 | Ilka| | Ott| t | t 410 | Elinor | | Ostrom | t | t 374 | Gregory | | O'Hare | t | t 33 | Terry | J.| Ord| t | t (4 rows) On May 10, 2009, at 4:41 AM, danaketh wrote: I'd suggest you to copy the echoed queries and run them directly in terminal (if you have access). Also if you have remote access to the database and can use tools like pgAdmin or Navicat, that could help you with testing. Or send me the table structure and I'll try them myself ;) Carol Walter napsal(a): Hello, I have a PHP program that contains a number of postgres queries. At the end of the program, it needs to write data to a database. You can see the code that I'm using below. I have die clauses on all the queries and I have the program echoing the queries that it runs to the screen. The die clause does not execute. The queries are echoed to the screen, but nothing is being written to the database. There don't appear to be any errors in the postgres log or the php log. Is there a function that I can use that will tell me exactly what is going on here? If there is, can you give me the syntax? Thanks in advance for your time. Carol P.S. This PHP 5 and PostgreSQL 8.3.6 on Solaris 10. +++ +++ I've written a query that needs to insert data into two base tables and a bridge table. The code looks like... /* Echo data for database to the screen */ echop Contact Locator: $cont_loc/p; echop Contact Type Rank: $cont_rank/p; echop Contact Info Type: $contact_type/p; echop New name string: $f_name_new/p; echop New name string: $m_name_new/p; echop New name string: $l_name_new/p; echop New ivl web string: $ivl_web_peop/p; echop New cns_web string: $cns_web_peop/p; echop New contact rank string: $cont_rank/p; echop New contact locator string: $cont_loc/p; echop New contact item string: $contact_info1/p; echop New contact type string: $contact_type/p; /* Connect to database*/ include connect_km_tezt.php; /* Run queries*/ $query = INSERT INTO \tblPeople\(\fName\,\mName\, \lName\, ivlweb, cnsweb) VALUES ('$f_name_new', '$m_name_new',' $l_name_new', '$ivl_web_peop', '$cns_web_peop'); echo First query: . $query . br /; $pg_peop_ins = pg_query($query) or die(Can't execute first query); // echo pg_last_error(Last Error . $pg_peop_ins); //echo pg_result_error($pg_peop_ins); $query = INSERT INTO \tblContactInformation \(\contactItem\,\contactType\) VALUES ('$contact_info1','$contact_type'); echo Second query: . $query . br /; $pg_contact_ins = pg_query($query) or die(Can't execute 2nd query); $query = INSERT INTO \brdgPeopleContactInformation\ (\peopleId\, \contactInformationId\,rank, type) VALUES (currval('\tblPeople_peopleId_seq \'),currval('\tblContactInformation_contactInformationId_seq \'), '$cont_rank', '$cont_loc'); echo Third query: . $query . br /; $pg_peop_cont_ins = pg_query($query) or die(Can't execute 3rd query); +++ ++ The postgres log looks like this ... [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]STATEMENT: INSERT INTO tblPeople(fName,mName,lName, ivlweb, cnsweb)
Re: [PHP-DB] PHP Postgres - query not writing to database.
Glad that you found the problem :) Carol Walter napsal(a): To all who helped. Thank you very much. I found the problem. There is a leading blank on the last name field that I couldn't see. It was coming from my program code. Thanks for all your help. Carol On May 11, 2009, at 4:23 PM, Carol Walter wrote: I have copied the queries into psql and wrapped them in a BEGIN and COMMIT. Even from psql the queries appear to work but don't store the information. There don't appear to be errors in the log either. Thanks for your help, Carol km_tezt=# begin; BEGIN km_tezt=# INSERT INTO tblPeople(fName,mName,lName, ivlweb, cnsweb) VALU ES ('Frank', 'D',' Oz', 't', 't'); INSERT 0 1 km_tezt=# INSERT INTO tblContactInformation(contactItem,contactType) VALU ES ('f...@indiana.edu','0010'); INSERT 0 1 km_tezt=# INSERT INTO brdgPeopleContactInformation (peopleId,contactInform ationId,rank, type) VALUES (currval('tblPeople_peopleId_seq'),currval('tblC ontactInformation_contactInformationId_seq'), '1', '100'); INSERT 0 1 km_tezt=# commit; COMMIT km_tezt=# select * from tblPeople where lName like 'O%'; peopleId | fName | mName | lName | ivlweb | cnsweb --+-+---+++ 404 | Ilka| | Ott| t | t 410 | Elinor | | Ostrom | t | t 374 | Gregory | | O'Hare | t | t 33 | Terry | J.| Ord| t | t (4 rows) On May 10, 2009, at 4:41 AM, danaketh wrote: I'd suggest you to copy the echoed queries and run them directly in terminal (if you have access). Also if you have remote access to the database and can use tools like pgAdmin or Navicat, that could help you with testing. Or send me the table structure and I'll try them myself ;) Carol Walter napsal(a): Hello, I have a PHP program that contains a number of postgres queries. At the end of the program, it needs to write data to a database. You can see the code that I'm using below. I have die clauses on all the queries and I have the program echoing the queries that it runs to the screen. The die clause does not execute. The queries are echoed to the screen, but nothing is being written to the database. There don't appear to be any errors in the postgres log or the php log. Is there a function that I can use that will tell me exactly what is going on here? If there is, can you give me the syntax? Thanks in advance for your time. Carol P.S. This PHP 5 and PostgreSQL 8.3.6 on Solaris 10. ++ I've written a query that needs to insert data into two base tables and a bridge table. The code looks like... /* Echo data for database to the screen */ echop Contact Locator: $cont_loc/p; echop Contact Type Rank: $cont_rank/p; echop Contact Info Type: $contact_type/p; echop New name string: $f_name_new/p; echop New name string: $m_name_new/p; echop New name string: $l_name_new/p; echop New ivl web string: $ivl_web_peop/p; echop New cns_web string: $cns_web_peop/p; echop New contact rank string: $cont_rank/p; echop New contact locator string: $cont_loc/p; echop New contact item string: $contact_info1/p; echop New contact type string: $contact_type/p; /* Connect to database*/ include connect_km_tezt.php; /* Run queries*/ $query = INSERT INTO \tblPeople\(\fName\,\mName\,\lName\, ivlweb, cnsweb) VALUES ('$f_name_new', '$m_name_new',' $l_name_new', '$ivl_web_peop', '$cns_web_peop'); echo First query: . $query . br /; $pg_peop_ins = pg_query($query) or die(Can't execute first query); // echo pg_last_error(Last Error . $pg_peop_ins); //echo pg_result_error($pg_peop_ins); $query = INSERT INTO \tblContactInformation\(\contactItem\,\contactType\) VALUES ('$contact_info1','$contact_type'); echo Second query: . $query . br /; $pg_contact_ins = pg_query($query) or die(Can't execute 2nd query); $query = INSERT INTO \brdgPeopleContactInformation\ (\peopleId\,\contactInformationId\,rank, type) VALUES (currval('\tblPeople_peopleId_seq\'),currval('\tblContactInformation_contactInformationId_seq\'), '$cont_rank', '$cont_loc'); echo Third query: . $query . br /; $pg_peop_cont_ins = pg_query($query) or die(Can't execute 3rd query); + The postgres log looks like this ... [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]STATEMENT: INSERT INTO tblPeople(fName,mName,lName,
Re: [PHP-DB] PHP Postgres - query not writing to database.
I'd suggest you to copy the echoed queries and run them directly in terminal (if you have access). Also if you have remote access to the database and can use tools like pgAdmin or Navicat, that could help you with testing. Or send me the table structure and I'll try them myself ;) Carol Walter napsal(a): Hello, I have a PHP program that contains a number of postgres queries. At the end of the program, it needs to write data to a database. You can see the code that I'm using below. I have die clauses on all the queries and I have the program echoing the queries that it runs to the screen. The die clause does not execute. The queries are echoed to the screen, but nothing is being written to the database. There don't appear to be any errors in the postgres log or the php log. Is there a function that I can use that will tell me exactly what is going on here? If there is, can you give me the syntax? Thanks in advance for your time. Carol P.S. This PHP 5 and PostgreSQL 8.3.6 on Solaris 10. ++ I've written a query that needs to insert data into two base tables and a bridge table. The code looks like... /* Echo data for database to the screen */ echop Contact Locator: $cont_loc/p; echop Contact Type Rank: $cont_rank/p; echop Contact Info Type: $contact_type/p; echop New name string: $f_name_new/p; echop New name string: $m_name_new/p; echop New name string: $l_name_new/p; echop New ivl web string: $ivl_web_peop/p; echop New cns_web string: $cns_web_peop/p; echop New contact rank string: $cont_rank/p; echop New contact locator string: $cont_loc/p; echop New contact item string: $contact_info1/p; echop New contact type string: $contact_type/p; /* Connect to database*/ include connect_km_tezt.php; /* Run queries */ $query = INSERT INTO \tblPeople\(\fName\,\mName\,\lName\, ivlweb, cnsweb) VALUES ('$f_name_new', '$m_name_new',' $l_name_new', '$ivl_web_peop', '$cns_web_peop'); echo First query: . $query . br /; $pg_peop_ins = pg_query($query) or die(Can't execute first query); // echo pg_last_error(Last Error . $pg_peop_ins); //echo pg_result_error($pg_peop_ins); $query = INSERT INTO \tblContactInformation\(\contactItem\,\contactType\) VALUES ('$contact_info1','$contact_type'); echo Second query: . $query . br /; $pg_contact_ins = pg_query($query) or die(Can't execute 2nd query); $query = INSERT INTO \brdgPeopleContactInformation\ (\peopleId\,\contactInformationId\,rank, type) VALUES (currval('\tblPeople_peopleId_seq\'),currval('\tblContactInformation_contactInformationId_seq\'), '$cont_rank', '$cont_loc'); echo Third query: . $query . br /; $pg_peop_cont_ins = pg_query($query) or die(Can't execute 3rd query); + The postgres log looks like this ... [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]STATEMENT: INSERT INTO tblPeople(fName,mName,lName, ivlweb, cnsweb) VALUES ('Frank', 'D',' Oz', 't', 't') [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: duration: 105.005 ms [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: PLANNER STATISTICS [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]DETAIL: ! system usage stats: ! 0.51 elapsed 0.50 user 0.06 system sec ! [0.064533 user 0.013546 sys total] ! 0/2 [2976/197116] filesystem blocks in/out ! 0/0 [44325584/1] page faults/reclaims, 0 [465469248] swaps ! 0 [0] signals rcvd, 1/3 [2/5] messages rcvd/sent ! 10/0 [-64186124/0] voluntary/involuntary context switches ! buffer usage stats: ! Shared blocks: 0 read, 0 written, buffer hit rate = 0.00% ! Local blocks: 0 read, 0 written, buffer hit rate = 0.00% ! Direct blocks: 0 read, 0 written [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]STATEMENT: INSERT INTO tblContactInformation(contactItem,contactType) VALUES ('f...@indiana.edu','0010') [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: duration: 10.856 ms [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: PLANNER STATISTICS [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]DETAIL: !
[PHP-DB] PHP Postgres - query not writing to database.
Hello, I have a PHP program that contains a number of postgres queries. At the end of the program, it needs to write data to a database. You can see the code that I'm using below. I have die clauses on all the queries and I have the program echoing the queries that it runs to the screen. The die clause does not execute. The queries are echoed to the screen, but nothing is being written to the database. There don't appear to be any errors in the postgres log or the php log. Is there a function that I can use that will tell me exactly what is going on here? If there is, can you give me the syntax? Thanks in advance for your time. Carol P.S. This PHP 5 and PostgreSQL 8.3.6 on Solaris 10. +++ +++ I've written a query that needs to insert data into two base tables and a bridge table. The code looks like... /* Echo data for database to the screen */ echop Contact Locator: $cont_loc/p; echop Contact Type Rank: $cont_rank/p; echop Contact Info Type: $contact_type/p; echop New name string: $f_name_new/p; echop New name string: $m_name_new/p; echop New name string: $l_name_new/p; echop New ivl web string: $ivl_web_peop/p; echop New cns_web string: $cns_web_peop/p; echop New contact rank string: $cont_rank/p; echop New contact locator string: $cont_loc/p; echop New contact item string: $contact_info1/p; echop New contact type string: $contact_type/p; /* Connect to database */ include connect_km_tezt.php; /* Run queries */ $query = INSERT INTO \tblPeople\(\fName\,\mName\,\lName\, ivlweb, cnsweb) VALUES ('$f_name_new', '$m_name_new',' $l_name_new', '$ivl_web_peop', '$cns_web_peop'); echo First query: . $query . br /; $pg_peop_ins = pg_query($query) or die(Can't execute first query); // echo pg_last_error(Last Error . $pg_peop_ins); //echo pg_result_error($pg_peop_ins); $query = INSERT INTO \tblContactInformation\(\contactItem\, \contactType\) VALUES ('$contact_info1','$contact_type'); echo Second query: . $query . br /; $pg_contact_ins = pg_query($query) or die(Can't execute 2nd query); $query = INSERT INTO \brdgPeopleContactInformation\ (\peopleId\,\contactInformationId\,rank, type) VALUES (currval('\tblPeople_peopleId_seq \'),currval('\tblContactInformation_contactInformationId_seq\'), '$cont_rank', '$cont_loc'); echo Third query: . $query . br /; $pg_peop_cont_ins = pg_query($query) or die(Can't execute 3rd query); +++ ++ The postgres log looks like this ... [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]STATEMENT: INSERT INTO tblPeople(fName,mName,lName, ivlweb, cnsweb) VALUES ('Frank', 'D',' Oz', 't', 't') [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: duration: 105.005 ms [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: PLANNER STATISTICS [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]DETAIL: ! system usage stats: ! 0.51 elapsed 0.50 user 0.06 system sec ! [0.064533 user 0.013546 sys total] ! 0/2 [2976/197116] filesystem blocks in/out ! 0/0 [44325584/1] page faults/reclaims, 0 [465469248] swaps ! 0 [0] signals rcvd, 1/3 [2/5] messages rcvd/sent ! 10/0 [-64186124/0] voluntary/involuntary context switches ! buffer usage stats: ! Shared blocks: 0 read, 0 written, buffer hit rate = 0.00% ! Local blocks: 0 read, 0 written, buffer hit rate = 0.00% ! Direct blocks: 0 read, 0 written [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]STATEMENT: INSERT INTO tblContactInformation(contactItem,contactType) VALUES ('f...@indiana.edu ','0010') [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: duration: 10.856 ms [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: PLANNER STATISTICS [km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]DETAIL: ! system usage stats: ! 0.28 elapsed 0.27 user 0.03 system sec ! [0.066803 user
[PHP-DB] PHP Generator
Thanks for all the suggestions. I just going to keep my head down and keep learning and practicing, I probably be sending many more questions conor _ Windows Live™ SkyDrive™: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_skydrive_042009
[PHP-DB] php generators
Hello Everyone, I am a beginner with PHP and Mysql and have dived into a project that may be to much for me right now. I am still learning php and do not have enough knowledge to accomplish what I am trying to. I have been looking into PHP code generators and was wondering if anyone has any thoughts or suggestions, also if anyone knows of any good resources for learning Thanks _ Rediscover Hotmail®: Get e-mail storage that grows with you. http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Storage2_042009
Re: [PHP-DB] php generators
Most code generators are bloated, poorly designed, and just plain trouble.The only code generator that I currently like, is the one for CakePHP, but you'll have to do some heavy reading to get up-to-speed on how to develop with Cake (especially considering it uses Object Oriented development principles, and the Model-View-Controller code separation pattern) If you put any time into CakePHP at all, I guarantee you'll like it. To generate code with Cake, you build your database tables for whatever data you're needing to store (and it's best to structure your tables using cake conventions), then from command line, you use cake bake, which will allow you to build your controller, model, and view for each table. Bake will allow you to automatically build create/read/update/delete functionality for every table, it will automatically detect which tables have related data, and will set up your code so that you can easily reference data between each table. It's a definite must-have, but I'm not sure how it would be for a PHP newbie. I believe there are several CakePHP books out there for the newbie that should get you up and running fast. Check it out at http://www.cakephp.org for more info -- Jonathan Langevin PHP Site Solutions http://www.phpsitesolutions.com On Tue, Apr 28, 2009 at 12:40 PM, conor mahaney crmahan...@live.com wrote: Hello Everyone, I am a beginner with PHP and Mysql and have dived into a project that may be to much for me right now. I am still learning php and do not have enough knowledge to accomplish what I am trying to. I have been looking into PHP code generators and was wondering if anyone has any thoughts or suggestions, also if anyone knows of any good resources for learning Thanks _ Rediscover Hotmail®: Get e-mail storage that grows with you. http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Storage2_042009
Re: [PHP-DB] php generators
Dreamweaver has some php generation. That's how I started to learn. I am not an expert by any means, and I am sure that experts will not like the code, but for a beginner, I found it totally fine On 4/28/2009 12:40 PM, conor mahaney wrote: Hello Everyone, I am a beginner with PHP and Mysql and have dived into a project that may be to much for me right now. I am still learning php and do not have enough knowledge to accomplish what I am trying to. I have been looking into PHP code generators and was wondering if anyone has any thoughts or suggestions, also if anyone knows of any good resources for learning Thanks _ Rediscover Hotmail®: Get e-mail storage that grows with you. http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Storage2_042009 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php