[PHP-DB] Re: Dear php experts
Bishnu wrote: I am new in PHP. I've just started programming with php. I am going to build a newsletter mailing of my own community. I use a table where members' name, email and other information is stored. I would like to send email to all member listed on member table. Could anyone give me functional code for it? I'd probably start from one of the working systems ;) Have a look at the list at http://www.opensourcecms.com/ -- Lester Caine - L.S.Caine Electronic Services -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] New to the list
also new to php and databases. Brief background to set the stage: I'm attempting to build a site. I'm using Dreamweaver, mySQL, and a RAD product called Impakt (the same people who do PHAKT). Impakt works on the php4 - ADODB model. Up to this point I haven't had to understand the code all too much to make things work, aka. inserts, deletions, updates, etc. Now to why I write today. I have an insert transaction form, about 10 fields. Two of those fields are for city and state. I have two tables: State Table:| City Table: (innodb)| (innodb) StateID (Primary Key) | CityID State | StateID City The city table has a foreign key on the StateID field referencing StateID in the state table. So far so good. In my form, I want a pull down menu for the state and a list / menu for the City. (You can probably anticipate the question) When a selection is made from the state list I want the city menu / list to reflect the associated cities. Now I already know that using pure PHP I would need to have the state selection set up as a post vars and pass it into another page. Unfortunately it can't work that way. So, I dug around more and see for behaviour like this, typically you would need to use javascript. The examples I've found are exactly what I want, only they use preformatted values and not the database / tables I wish to use. That is pretty much my dilemma. Just not sure how to go about it to make it work. Appreciate any help or suggestions! Thank you, Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] New to the list
Right, I realize that as mentioned in my post. I thought this would be the best place though to ask how people work around this. Thank you, Stuart --- [EMAIL PROTECTED] wrote: php is server-side. i.e., until the page is returned to the server the user's selections are unknown so no action can be taken on them. e.g., with php you can't get the selected state's city list until the user's request is submitted and a new page (with the specific city list) is returned to the user. -- Original Message -- From: Stuart Felenstein [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Sunday, August 29, 2004 04:35:52 AM -0700 Subject: [PHP-DB] New to the list also new to php and databases. Brief background to set the stage: I'm attempting to build a site. I'm using Dreamweaver, mySQL, and a RAD product called Impakt (the same people who do PHAKT). Impakt works on the php4 - ADODB model. Up to this point I haven't had to understand the code all too much to make things work, aka. inserts, deletions, updates, etc. Now to why I write today. I have an insert transaction form, about 10 fields. Two of those fields are for city and state. I have two tables: State Table:| City Table: (innodb)| (innodb) StateID (Primary Key) | CityID State | StateID City The city table has a foreign key on the StateID field referencing StateID in the state table. So far so good. In my form, I want a pull down menu for the state and a list / menu for the City. (You can probably anticipate the question) When a selection is made from the state list I want the city menu / list to reflect the associated cities. Now I already know that using pure PHP I would need to have the state selection set up as a post vars and pass it into another page. Unfortunately it can't work that way. So, I dug around more and see for behaviour like this, typically you would need to use javascript. The examples I've found are exactly what I want, only they use preformatted values and not the database / tables I wish to use. That is pretty much my dilemma. Just not sure how to go about it to make it work. Appreciate any help or suggestions! Thank you, Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- End Original Message -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Updating a table when using LEFT JOIN
I tried something similar, though only updating one table, where the columns matched, and got errors: $query=UPDATE t1 SET t1.f1=t2.f2 WHERE t1.f3=t2.f4; query failed: Unknown table 't2' in where clause. However, t2 clearly does exist. Using nested query: $query=UPDATE t1 SET t1.f1=(SELECT t2.f2 FROM t2WHERE t2.f3='412') WHERE t1.f4='412'; Error in query syntax near SELECT t2.f2 FROM t2WHERE t2.f3= I was trying to update a column in t1 where there is a unique join with another table on another field of t1. Should I use UPDATE t1 INNER JOIN t2 ON t1.f3=t2.f4 SET t1.f1=t2.f2 WHERE t1.f3=t2.f4?? Also, what happens if in the example below, items.id=month.id, there is more than one matching item in month.id? Using PHP 4.3.4 John - Original Message - From: Micah Stevens [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 27, 2004 5:13 AM Subject: Re: [PHP-DB] Updating a table when using LEFT JOIN From the Mysql docs: Starting with MySQL 4.0.4, you can also perform UPDATE operations that cover multiple tables: UPDATE items,month SET items.price=month.price WHERE items.id=month.id; The example shows an inner join using the comma operator, but multiple-table UPDATE statements can use any type of join allowed in SELECT statements, such as LEFT JOIN. Note: You cannot use ORDER BY or LIMIT with multiple-table UPDATE. -Micah On Thursday 26 August 2004 03:23 pm, Chris Payne wrote: Hi there everyone, I am using the following to grab the data I need from several tables: $sql = SELECT * FROM vendorprices LEFT JOIN fooditems on (vendorprices.FoodItemNumber = fooditems.FoodItemID) WHERE vendorprices.VendorNumber='$VendorID' ORDER BY vendorprices.VendorItemNumber; This works great, very fast etc .. the problem is, I then need to give the option for them to edit the items - again, not a problem in populating the form - until I have to then use the UPDATE function, how can I update each item in separate tables when I use the above join to grab the info in the first place? I've never had to write to 2 tables at once where data is relative like this, infact it was my first time of using JOINS at all to even display the data. I'm using PHP with MySQL. Thank you. Chris -- 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] New to the list
Please use a _descriptive_ subject. On Sunday 29 August 2004 19:35, Stuart Felenstein wrote: So, I dug around more and see for behaviour like this, typically you would need to use javascript. The examples I've found are exactly what I want, only they use preformatted values and not the database / tables I wish to use. Have php pull the data required, have php output the appropriate javascript code using the pulled data _instead_ of the 'preformatted values'. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Ada is PL/I trying to be Smalltalk. -- Codoso diBlini */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: ODBC_Connect error message
My Problem ended up being that i was compileing a 64 bit php with 32 bit libraries for DB2, once i was able to get the 64 bit libraries for DB2 and compile php it worked just fine after that. -Cameron -Original Message- From: Anni Hienola [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 13:31 To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: ODBC_Connect error message Hello I'm having pretty much the same problem and no help from web. Im very curious to know, if you were able to solve this problem. My setup is as follows: RedHat EL WS on x86 apache 2.0.50, PHP 4.3.8 IBM UDB DB2 personal edition 8.1 PHP was configured with options --with-ibm-db2=/opt/IBM/db2/V8.1/ --with-apxs2=/usr/local/apache2/bin/apxs I also tried this with the RPM packages for apache provided by RedHat but there was no difference in behavior. The problem is in PHP, because when I use a simple script from command line to access DB2 (script below), I get the same gibberish SQL error than via web browser. Sequence of actions: launch db2profile from /home/db2inst1/sqllib (db2 instance user) restart apache from the same shell php db2.php script db2.php ?php $conn = odbc_connect('mmtest', 'd2inst1', 'instance'); odbc_close($conn); ? Line two gives the SQL error. Warning: odbc_connect(): SQL error: ?M?, SQL state d$ D?x???E,a;?? in SQLConnect in /usr/local/apache2/htdocs/db2.php on line 2 Any help is greatly appreciated. Anni Hienola Cameron Seader wrote: Greetings, I am having some trouble with this error message and finding out what it really means. I receive this in my HTTP error log from apache 1.3. [Tue Aug 17 23:36:04 2004] [error] PHP Warning: odbc_connect(): SQL error: , SQL state ÿÿÿþ in SQLConnect in /srv/www/htdocs/acquisuite/idxdb2.php on line 572 I have no idea why this is doing this. It worked on another machine, but eversince in I put it on a new machine i get this message. I am running SLES 8 for s390x on Mainframe. It is 64 bit. my configure options for PHP are: ./configure --with-apxs --enable-track-vars --with-ibm-db2=/home/db2admin/sqllib --enable-bcmath --with-zlib=yes So i have DB2 support with DB2 Connect installed on SUSE. It has worked before on a RedHat 7.2 OS on s390x platform. Does anyone have any idea what the SQL state ÿÿÿþ means? TIA, Cameron Seader [INFO] -- Access Manager: This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. A2 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. A1. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Dear php experts
Hello, On 08/29/2004 02:06 AM, Bishnu wrote: I am new in PHP. I've just started programming with php. I am going to build a newsletter mailing of my own community. I use a table where members' name, email and other information is stored. I would like to send email to all member listed on member table. Could anyone give me functional code for it? If you want to send personalized messages (or not) to many users, you may want to try this class is that provides some optimization support for bulk mailing: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Webpage response to selection $_POST
Hi all. I have a list of users in a database that I would like to show on a dynamic webpage. With each of these users that shows up on the page, there is going to be a checkbox next to their name so that I can perform multiple tasks, such as 'Remove User' or 'Modify Information'. I have all of the appropriate information showing up on the page, including the checkboxes. My question is... if I select a checkbox for a user, the other pages do not even recognize that I have selected that checkbox and I am using the $_POST method - why is that? I have even attempted to use the import_request_variables function - no luck. So, I cannot verify which users I want to perform an action on. Anyone have any ideas? Snippets of code to follow... Thanks in advance, ~Philip form action=performaction.php method=post table ?php for ($j=0; $j$numRows; $j++) { echo 'tr' . \n; echo ' tdinput type=checkbox name=user' . $j . ' value=1/td' . \n; echo ' td' . $dbid[$j] . '/td' . \n; echo ' td' . $firstName[$j] . '/td' . \n; echo ' td' . $lastName[$j] . '/td' . \n; echo ' td' . $uid[$j] . '/td' . \n; echo ' td' . $username[$j] . '/td' . \n; echo ' td' . $classification[$j] . '/td' . \n; echo ' /tr' . \n; } ? /table input type=submit name=removeuser value=Remove User / input type=submit name=modifyclass value=Modify Classification / input type=hidden name=beenSubmitted value=1 / /form
RE: [PHP-DB] Webpage response to selection $_POST
Hi you need to check for $_POST[user1], $_POST[user2] etc - is that what you are doing? Your other variables are done as an array - $firstName[$j] etc, should your check box be echo ' tdinput type=checkbox name=user[' . $j . '] value=1/td' . \n; (note the []) Otherwise try vardump($_POST) to see exactly what is being returned. If this does not fix it try posting the code that handles the response and we will try and help. Peter -Original Message- From: Philip Thompson [mailto:[EMAIL PROTECTED] Sent: 30 August 2004 00:12 To: [EMAIL PROTECTED] Subject: [PHP-DB] Webpage response to selection $_POST Hi all. I have a list of users in a database that I would like to show on a dynamic webpage. With each of these users that shows up on the page, there is going to be a checkbox next to their name so that I can perform multiple tasks, such as 'Remove User' or 'Modify Information'. I have all of the appropriate information showing up on the page, including the checkboxes. My question is... if I select a checkbox for a user, the other pages do not even recognize that I have selected that checkbox and I am using the $_POST method - why is that? I have even attempted to use the import_request_variables function - no luck. So, I cannot verify which users I want to perform an action on. Anyone have any ideas? Snippets of code to follow... Thanks in advance, ~Philip form action=performaction.php method=post table ?php for ($j=0; $j$numRows; $j++) { echo 'tr' . \n; echo ' tdinput type=checkbox name=user' . $j . ' value=1/td' . \n; echo ' td' . $dbid[$j] . '/td' . \n; echo ' td' . $firstName[$j] . '/td' . \n; echo ' td' . $lastName[$j] . '/td' . \n; echo ' td' . $uid[$j] . '/td' . \n; echo ' td' . $username[$j] . '/td' . \n; echo ' td' . $classification[$j] . '/td' . \n; echo ' /tr' . \n; } ? /table input type=submit name=removeuser value=Remove User / input type=submit name=modifyclass value=Modify Classification / input type=hidden name=beenSubmitted value=1 / /form -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] end of line
Hi. I'm trying to find a simple way to allow a client to update a notes page on her site whenever she wants. I created a form which allows her to save a few paragraphs to a mysql table. What I want to do, though, is write her paragraphs to an html page so others can see her words. Is there a way to replace newlines with p tags, so that her carriage returns show up as separate paragraphs when I write it to html? Also, she uses a mac - doesn't mac register newlines and carriage returns different than windows or unix? Thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] end of line
Try this: echo str_replace ( \n, p, $string); I believe it always stores newlines as \n, since PHP and MySQL are native to Unix/Linux. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: ODBC_Connect error message
My system is 32-bit, so I guess PHP configured itself as 32-bit when I compiled it. So that wasn't quite like my problem. Anyway this suggests that the PHP compilation is the key here. Looking at the configure help I couldn't even start guessing what I could possibly change. I try to play around with the optimization flags, first. If somebody has any suggestions, I would very much like to hear them. Anni H. On Sun, 2004-08-29 at 15:47, Seader, Cameron wrote: My Problem ended up being that i was compileing a 64 bit php with 32 bit libraries for DB2, once i was able to get the 64 bit libraries for DB2 and compile php it worked just fine after that. -Cameron -Original Message- From: Anni Hienola [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 13:31 To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: ODBC_Connect error message Hello I'm having pretty much the same problem and no help from web. Im very curious to know, if you were able to solve this problem. My setup is as follows: RedHat EL WS on x86 apache 2.0.50, PHP 4.3.8 IBM UDB DB2 personal edition 8.1 PHP was configured with options --with-ibm-db2=/opt/IBM/db2/V8.1/ --with-apxs2=/usr/local/apache2/bin/apxs I also tried this with the RPM packages for apache provided by RedHat but there was no difference in behavior. The problem is in PHP, because when I use a simple script from command line to access DB2 (script below), I get the same gibberish SQL error than via web browser. Sequence of actions: launch db2profile from /home/db2inst1/sqllib (db2 instance user) restart apache from the same shell php db2.php script db2.php ?php $conn = odbc_connect('mmtest', 'd2inst1', 'instance'); odbc_close($conn); ? Line two gives the SQL error. Warning: odbc_connect(): SQL error: ?M?, SQL state d$ D?x???E,a;?? in SQLConnect in /usr/local/apache2/htdocs/db2.php on line 2 Any help is greatly appreciated. Anni Hienola Cameron Seader wrote: Greetings, I am having some trouble with this error message and finding out what it really means. I receive this in my HTTP error log from apache 1.3. [Tue Aug 17 23:36:04 2004] [error] PHP Warning: odbc_connect(): SQL error: , SQL state in SQLConnect in /srv/www/htdocs/acquisuite/idxdb2.php on line 572 I have no idea why this is doing this. It worked on another machine, but eversince in I put it on a new machine i get this message. I am running SLES 8 for s390x on Mainframe. It is 64 bit. my configure options for PHP are: ./configure --with-apxs --enable-track-vars --with-ibm-db2=/home/db2admin/sqllib --enable-bcmath --with-zlib=yes So i have DB2 support with DB2 Connect installed on SUSE. It has worked before on a RedHat 7.2 OS on s390x platform. Does anyone have any idea what the SQL state means? TIA, Cameron Seader [INFO] -- Access Manager: This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. A2 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php