RE: [PHP-DB] Re: [PEAR] Pear installation error
You could make life really simple and write csv document (excel loves those as long as you handle the data right)force the file to download with the additional add-type header set to vnd/ms-excel and excel opens it up automagically...much simpler, no? we do this for (gasp) asp data to excel all the time bastien From: Antoine <[EMAIL PROTECTED]> Reply-To: Antoine <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: [PEAR] Pear installation error Date: Fri, 8 Oct 2004 21:01:29 +0200 On 8 Oct 2004 17:03:15 -, Kevin Kraeer <[EMAIL PROTECTED]> wrote: > I'm a one man band working for an ad agency...good times. At any rate, a > client has requested that form values submitted through their website be > written to an excel document. > > I investigated and decided PEAR was probably my best bet (there's an excel > writer module if I understand correctly). So, I began what has become a > quest to successfully install PEAR to our staging server. > > It's a Win2K Server running IIS and PHP 4.3.6. Whoever initially installed > PHP 4 did not install PEAR along with it for some reason. So I decided to > run the command line installer, with the following directories set up: > > Installation prefix - C:\PHP\pear > Binaries Directory - $prefix\bin > PHP code directory - $ prefix\docs > Documentation base directory - $prefix\docs > Data Base Directory - $prefix\data > Tests Directory - $prefix\tests > php.exe Path - C:\PHP\php.exe > > I then run the installer, and it does fine for a while. Then, after > 'Extracting Installer' appears I get this: > > Warning: main(PEAR.php): failed to open stream: No such file or directory > in C:\PHP\pear\Archive\Tar.php on line 21 > > Fatal error: main(): Failed opening required 'PEAR.php' > (include_path='/C:\DOCUME~1\ADMIN~1.ORB\LOCALS~1\Temp\3\gop1c.tmp') in > C:\PHP\pear\Archive\Tar.php on line 21 > > So it seems pretty clear that it's an include path problem to me. In my > PHP.ini, go-pear added > > include_path=".;C:\php\pear" > > So maybe I need to change that to someplace else? But I'm also not so sure > about that forward slash in front of 'C:\DOCUME~`.' > > Any ideas or advice would be greatly appreciated. As I said, I'm on a solo > mission over here - no IT guys, no programming dept. Just ME. heh. This is probably going to get me flamed terribly, or rather completely ignored... If it is just you, why on earth don't you upgrade to a real operating system? *nix + apache[1-2] + php is go beautifully together..., won't cost you anything in licencing (assuming you don't get a proprietary unix), and is much less likely to be troubled by viruses and whatnot... I say this because usually the installation of these three packages is done with about 5 clicks, and gets configured pretty much by itself (of course, if you want security and stuff, you have to change the config, but I am sure that is not different to IIS...). Just a suggestion. Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Powerful Parental Controls Let your child discover the best the Internet has to offer. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Why does this conditional run, even if not true?
hard to say without the code for the function...what is returned by the fuction determines if the code runs, right? Are you sure the code is returning "YES"? Maybe post the code for the function bastien From: Karen Resplendo <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: [PHP-DB] Why does this conditional run, even if not true? Date: Fri, 8 Oct 2004 18:33:02 -0700 (PDT) $c is a field in an array I have loaded in from a text file. For some reason, none of the conditionals branch off and I end up printing out error messages for every row in the text file. My brackets are balanced, I just didn't include the bottom part: If ($c==9) { If($fieldarray[3]=="P") { $reject=validate($fieldarray[0],$c,$connectionSDWIS, $fieldarray[$c],$c); This If statement runs even if $reject = "YES". Can't figure out why: if ($reject=="NO") { // //loop through the rows in the this text file checking for Original ID of Repeat // $handle2 = fopen ($uploadfileandpath,"r"); while ($field2array = fgetcsv ($handle2, $userfile_size, ",")) { If($field2array[2]!=$fieldarray[$c]) { echo "Field 2 of array 2 text row: ".$field2array[2].""; echo "Field 9 of array 1 text row: ".$fieldarray[$c].""; $acceptOrReject = "R"; $displayrows.="See below: Original Sample ID for Repeat does not exist : ".$fieldarray[$c].""; } } //end of while loop fclose($handle2); }//end of If($reject =="No") - Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. _ Don't just Search. Find! http://search.sympatico.msn.ca/default.aspx The new MSN Search! Check it out! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Why does this conditional run, even if not true?
$c is a field in an array I have loaded in from a text file. For some reason, none of the conditionals branch off and I end up printing out error messages for every row in the text file. My brackets are balanced, I just didn't include the bottom part: If ($c==9) { If($fieldarray[3]=="P") { $reject=validate($fieldarray[0],$c,$connectionSDWIS, $fieldarray[$c],$c); This If statement runs even if $reject = "YES". Can't figure out why: if ($reject=="NO") { // //loop through the rows in the this text file checking for Original ID of Repeat // $handle2 = fopen ($uploadfileandpath,"r"); while ($field2array = fgetcsv ($handle2, $userfile_size, ",")) { If($field2array[2]!=$fieldarray[$c]) { echo "Field 2 of array 2 text row: ".$field2array[2].""; echo "Field 9 of array 1 text row: ".$fieldarray[$c].""; $acceptOrReject = "R"; $displayrows.="See below: Original Sample ID for Repeat does not exist : ".$fieldarray[$c].""; } } //end of while loop fclose($handle2); }//end of If($reject =="No") - Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish.
Re: [PHP-DB] Help: Arrays with Session Variables not happening
K ..my problem seems to be combining echo on the menu values with the print array. If I echo $array[0]; that seems to work fine !? Stuart --- Stuart Felenstein <[EMAIL PROTECTED]> wrote: > Back again , sorry :) > > I had my form set up with 7 multi selects , on the > return page, all 7 arrays were returned correctly. > Now that I've changed back 5 to regular menu selects > (1 selection), the 2 arrays left won't return the > values. The menus work fine. > > Here is my code: > > Page 1: > > session_start(); > > if ( empty( $_SESSION['l_industry'] ) ) { > $_SESSION['l_industry']=array(); > } > > if ( is_array( $_REQUEST['LurkerIndustry'] ) ) { > $_SESSION['l_industry'] = array_unique( > array_merge( $_SESSION['l_industry'], > $_REQUEST['LurkerIndustry'] ) > ); > } > if ( empty( $_SESSION['l_tterm'] ) ) { > $_SESSION['l_tterm']=array(); > } > > if ( is_array( $_REQUEST['LurkerTaxTerm'] ) ) { > $_SESSION['l_tterm'] = array_unique( > array_merge( $_SESSION['l_tterm'], > $_REQUEST['LurkerTaxTerm'] ) > ); > } > ?> > $LurkerEdu = $_REQUEST['LurkerEdu']; > $LurkerAuth = $_REQUEST['LurkerAuth']; > $LurkerExperience = $_REQUEST['LurkerExperience']; > $LurkerLevel = $_REQUEST['LurkerLevel']; > $LurkerSecurity = $_REQUEST['LurkerSecurity']; > ?> > > > Page 2: > > session_start(); > ?> > > > > Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > > > > > Untitled Document > > > > echo "\$LurkerEdu = ".$LurkerEdu.""; > echo "\$LurkerAuth = ".$LurkerAuth.""; > echo "\$LurkerExperience = > ".$LurkerExperience.""; > echo "\$LurkerLevel = ".$LurkerLevel.""; > echo "\$LurkerSecurity = ".$LurkerSecurity.""; > > > > if ( is_array( $_SESSION['LurkerIndustry'] ) ) { > print "Your industry:\n"; > foreach ( $_SESSION['LurkerIndustry'] as $p2 ) { > print "$p2"; > } > print ""; > } > > if ( is_array( $_SESSION['LurkerTaxTerm'] ) ) { > print "Your tax type:\n"; > foreach ( $_SESSION['LurkerTaxTerm'] as $p6 ) { > print "$p6"; > } > print ""; > } > ?> > > -- > 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] Help: Arrays with Session Variables not happening
Back again , sorry :) I had my form set up with 7 multi selects , on the return page, all 7 arrays were returned correctly. Now that I've changed back 5 to regular menu selects (1 selection), the 2 arrays left won't return the values. The menus work fine. Here is my code: Page 1: Page 2: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> Untitled Document "; echo "\$LurkerAuth = ".$LurkerAuth.""; echo "\$LurkerExperience = ".$LurkerExperience.""; echo "\$LurkerLevel = ".$LurkerLevel.""; echo "\$LurkerSecurity = ".$LurkerSecurity.""; if ( is_array( $_SESSION['LurkerIndustry'] ) ) { print "Your industry:\n"; foreach ( $_SESSION['LurkerIndustry'] as $p2 ) { print "$p2"; } print ""; } if ( is_array( $_SESSION['LurkerTaxTerm'] ) ) { print "Your tax type:\n"; foreach ( $_SESSION['LurkerTaxTerm'] as $p6 ) { print "$p6"; } print ""; } ?> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] -14 Days Ago
Cole S. Ashcraft wrote: I am trying to see whether a data in an array pulled from a MySQL DB (YEARMONTHDATE) is older than 14 days ago. I am trying to do this in PHP. My code looks like: if($array['due'] <= $today - 14) { echo "Assignment In Void:Assignments in the void are read-only"; require('footer.php'); exit; }. I am having problems with the math. How do I do a date subtraction without ending up with something like 20040994 (not a valid date)? Thanks, Cole You need dates in timestamp format to subtract them. You can use the function strtotime() to convert to timestamp. For instance, you can use: $old_date = strtotime("2 weeks ago"); You then just need to convert the date from the database to a timestamp. strtotime will do something like: $db_date = strtotime("October 10 2004"); or $db_date = strtotime("10 October 2004"); But, I don't think it will do it your way. You may have to change the order of your string, as well as add spaces. Check the manual at http://us4.php.net/strtotime. IF the database value is in some kind of MySQL date format, you can perhaps retrieve it as a timestamp. MySQL has several DATE formats and date/time functions. Janet -- Janet Valade -- janet.valade.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] -14 Days Ago
That would probably work, and its not too hard to do a rows returned check. Richard Hutchins wrote: Cole, I don't know the full context of how you need to do your date math. However, what if, instead of selecting a bunch of data and putting it in an array in PHP then checking to see if its older than 14 days you wrote your query to pull only those records that are older than 14 days? Something like (assuming MySQL): mysql> select contentID, printDate from docmeta where TO_DAYS(NOW()) - TO_DAYS(printDate) > 14; The above query subtracts a column's value from today's date. If the difference is greater than 14, it get pulled into the query. If you only wanted records newer than 14 days, you would just flip the comparison operator like so: mysql> select contentID, printDate from docmeta where TO_DAYS(NOW()) - TO_DAYS(printDate) < 14; (I hope I got that right) Anyway, from there, you could do whatever you need to do with the result set programmatically inside of your PHP script. My hunch is that it might be a little faster to do the date math in MySQL (or your db of choice) and just work with the exact result set you want inside your script. Hope this helps. Rich -Original Message- From: Cole S. Ashcraft [mailto:[EMAIL PROTECTED] Sent: Friday, October 08, 2004 2:36 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] -14 Days Ago I am trying to see whether a data in an array pulled from a MySQL DB (YEARMONTHDATE) is older than 14 days ago. I am trying to do this in PHP. My code looks like: if($array['due'] <= $today - 14) { echo "Assignment In Void:Assignments in the void are read-only"; require('footer.php'); exit; }. I am having problems with the math. How do I do a date subtraction without ending up with something like 20040994 (not a valid date)? Thanks, Cole -- 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] -14 Days Ago
That's probably the best way to go, but if you wanted another way: $mySqlDate = "20041008"; $month = substr($mySqlDate,4,2); $day = substr($mySqlDate,6,2); $year = substr($mySqlDate,0,4); $mySqlDateSerial = mktime(0,0,0,$month,$day,$year); $twoWeeksAgoSerial = mktime(0,0,0,date("m"),date("d")-14,date("Y")); If ($mySqlDateSerial < $twoWeeksAgoSerial) { echo "Assignment In Void:Assignments in the void are read-only"; require('footer.php'); exit; } But I always do things the hard way. Haha. -TG > -Original Message- > From: Wendell Frohwein [mailto:[EMAIL PROTECTED] > Sent: Friday, October 08, 2004 2:57 PM > To: 'Cole S. Ashcraft'; [EMAIL PROTECTED] > Subject: RE: [PHP-DB] -14 Days Ago > > > You can trying using the MySQL DATE_ADD() , DATE_SUB , and NOW() > functions. > > > -wendell frohwein > > -Original Message- > From: Cole S. Ashcraft [mailto:[EMAIL PROTECTED] > Sent: Friday, October 08, 2004 11:36 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] -14 Days Ago > > I am trying to see whether a data in an array pulled from a MySQL DB > (YEARMONTHDATE) is older than 14 days ago. I am trying to do this in > PHP. My code looks like: > > if($array['due'] <= $today - 14) > { > echo "Assignment In Void:Assignments in the void are > read-only"; > require('footer.php'); > exit; > }. > > I am having problems with the math. How do I do a date subtraction > without ending up with something like 20040994 (not a valid date)? > > Thanks, > Cole -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] -14 Days Ago
Cole, I don't know the full context of how you need to do your date math. However, what if, instead of selecting a bunch of data and putting it in an array in PHP then checking to see if its older than 14 days you wrote your query to pull only those records that are older than 14 days? Something like (assuming MySQL): mysql> select contentID, printDate from docmeta where TO_DAYS(NOW()) - TO_DAYS(printDate) > 14; The above query subtracts a column's value from today's date. If the difference is greater than 14, it get pulled into the query. If you only wanted records newer than 14 days, you would just flip the comparison operator like so: mysql> select contentID, printDate from docmeta where TO_DAYS(NOW()) - TO_DAYS(printDate) < 14; (I hope I got that right) Anyway, from there, you could do whatever you need to do with the result set programmatically inside of your PHP script. My hunch is that it might be a little faster to do the date math in MySQL (or your db of choice) and just work with the exact result set you want inside your script. Hope this helps. Rich > -Original Message- > From: Cole S. Ashcraft [mailto:[EMAIL PROTECTED] > Sent: Friday, October 08, 2004 2:36 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] -14 Days Ago > > > I am trying to see whether a data in an array pulled from a MySQL DB > (YEARMONTHDATE) is older than 14 days ago. I am trying to do this in > PHP. My code looks like: > > if($array['due'] <= $today - 14) > { > echo "Assignment In Void:Assignments in the void are > read-only"; > require('footer.php'); > exit; > }. > > I am having problems with the math. How do I do a date subtraction > without ending up with something like 20040994 (not a valid date)? > > Thanks, > Cole > > -- > 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] -14 Days Ago
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html That web page has tons of details. metin Cole S. Ashcraft wrote: I am trying to see whether a data in an array pulled from a MySQL DB (YEARMONTHDATE) is older than 14 days ago. I am trying to do this in PHP. My code looks like: if($array['due'] <= $today - 14) { echo "Assignment In Void:Assignments in the void are read-only"; require('footer.php'); exit; }. I am having problems with the math. How do I do a date subtraction without ending up with something like 20040994 (not a valid date)? Thanks, Cole -- This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PEAR] Pear installation error
On 8 Oct 2004 17:03:15 -, Kevin Kraeer <[EMAIL PROTECTED]> wrote: > I'm a one man band working for an ad agency...good times. At any rate, a > client has requested that form values submitted through their website be > written to an excel document. > > I investigated and decided PEAR was probably my best bet (there's an excel > writer module if I understand correctly). So, I began what has become a > quest to successfully install PEAR to our staging server. > > It's a Win2K Server running IIS and PHP 4.3.6. Whoever initially installed > PHP 4 did not install PEAR along with it for some reason. So I decided to > run the command line installer, with the following directories set up: > > Installation prefix - C:\PHP\pear > Binaries Directory - $prefix\bin > PHP code directory - $ prefix\docs > Documentation base directory - $prefix\docs > Data Base Directory - $prefix\data > Tests Directory - $prefix\tests > php.exe Path - C:\PHP\php.exe > > I then run the installer, and it does fine for a while. Then, after > 'Extracting Installer' appears I get this: > > Warning: main(PEAR.php): failed to open stream: No such file or directory > in C:\PHP\pear\Archive\Tar.php on line 21 > > Fatal error: main(): Failed opening required 'PEAR.php' > (include_path='/C:\DOCUME~1\ADMIN~1.ORB\LOCALS~1\Temp\3\gop1c.tmp') in > C:\PHP\pear\Archive\Tar.php on line 21 > > So it seems pretty clear that it's an include path problem to me. In my > PHP.ini, go-pear added > > include_path=".;C:\php\pear" > > So maybe I need to change that to someplace else? But I'm also not so sure > about that forward slash in front of 'C:\DOCUME~`.' > > Any ideas or advice would be greatly appreciated. As I said, I'm on a solo > mission over here - no IT guys, no programming dept. Just ME. heh. This is probably going to get me flamed terribly, or rather completely ignored... If it is just you, why on earth don't you upgrade to a real operating system? *nix + apache[1-2] + php is go beautifully together..., won't cost you anything in licencing (assuming you don't get a proprietary unix), and is much less likely to be troubled by viruses and whatnot... I say this because usually the installation of these three packages is done with about 5 clicks, and gets configured pretty much by itself (of course, if you want security and stuff, you have to change the config, but I am sure that is not different to IIS...). Just a suggestion. Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] -14 Days Ago
I needto do it in PHP, though. Cole Wendell Frohwein wrote: You can trying using the MySQL DATE_ADD() , DATE_SUB , and NOW() functions. -wendell frohwein -Original Message- From: Cole S. Ashcraft [mailto:[EMAIL PROTECTED] Sent: Friday, October 08, 2004 11:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] -14 Days Ago I am trying to see whether a data in an array pulled from a MySQL DB (YEARMONTHDATE) is older than 14 days ago. I am trying to do this in PHP. My code looks like: if($array['due'] <= $today - 14) { echo "Assignment In Void:Assignments in the void are read-only"; require('footer.php'); exit; }. I am having problems with the math. How do I do a date subtraction without ending up with something like 20040994 (not a valid date)? Thanks, Cole -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] -14 Days Ago
You can trying using the MySQL DATE_ADD() , DATE_SUB , and NOW() functions. -wendell frohwein -Original Message- From: Cole S. Ashcraft [mailto:[EMAIL PROTECTED] Sent: Friday, October 08, 2004 11:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] -14 Days Ago I am trying to see whether a data in an array pulled from a MySQL DB (YEARMONTHDATE) is older than 14 days ago. I am trying to do this in PHP. My code looks like: if($array['due'] <= $today - 14) { echo "Assignment In Void:Assignments in the void are read-only"; require('footer.php'); exit; }. I am having problems with the math. How do I do a date subtraction without ending up with something like 20040994 (not a valid date)? Thanks, Cole -- 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] -14 Days Ago
I am trying to see whether a data in an array pulled from a MySQL DB (YEARMONTHDATE) is older than 14 days ago. I am trying to do this in PHP. My code looks like: if($array['due'] <= $today - 14) { echo "Assignment In Void:Assignments in the void are read-only"; require('footer.php'); exit; }. I am having problems with the math. How do I do a date subtraction without ending up with something like 20040994 (not a valid date)? Thanks, Cole -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help: First Time Form with Sessions
Figured it out. Page 2 had to have the field name in the $SESSION parameters, not the holder from the Page1 array register. Stuart --- Stuart Felenstein <[EMAIL PROTECTED]> wrote: > Well I guess too much success at once is a bad > thing. > > For some unapparent reason, the variables here are > not > carrying over. Anyone see anything wrong here ? > > Page1 (Somewhat snipped) > > session_start(); > > if ( empty( $_SESSION['l_education'] ) ) { > $_SESSION['l_education']=array(); > } > > if ( is_array( $_REQUEST['LurkerEdu'] ) ) { > $_SESSION['l_education'] = array_unique( > array_merge( $_SESSION['l_education'], > $_REQUEST['LurkerEdu'] ) > ); > } > ?> > multiple="multiple" size="3"> > > Page 2: > > session_start(); > ?> > > Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > > > > Untitled Document > > > if ( is_array( $_SESSION['l_education'] ) ) { > print "Your cart:\n"; > foreach ( $_SESSION['l_education'] as $p1 ) { > print "$p1"; > } > print ""; > > -- > 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] Help: First Time Form with Sessions
Well I guess too much success at once is a bad thing. For some unapparent reason, the variables here are not carrying over. Anyone see anything wrong here ? Page1 (Somewhat snipped) Page 2: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> Untitled Document Your cart:\n"; foreach ( $_SESSION['l_education'] as $p1 ) { print "$p1"; } print ""; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Dynamic pull down menus with PHP/Mysql
On Fri, 8 Oct 2004 01:12:06 -0400, GH <[EMAIL PROTECTED]> wrote: > For a project in college that I had once did using ColdFusion and > MSAccess (please dont kill me :)) I had the simular situation > > What I did was when the First Drop Down was changed... it had an > onChange action or something of that nature (do not have my exact code > infront of me) that went to a JS function which sent the value to > another frame (window) you can use a hidden 1x1 iframe to conduct > this... it then returned the values to the other page via JS I > have to Dig for the code which unfortinately is buried at the > moment > > > > > On Tue, 5 Oct 2004 08:22:22 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote: > > > -Original Message- > > > This may be a more javascript related topic, but it's also php/mysql. > > > Apologies in advance if this is too far off topic. > > > > > > I'm trying to pull data from MySQL using PHP to sort the results into a > > > form with a pull down menu. That works fine; I can do that. > > > > > > But I have a second pull down menu whose items need to display based on > > > the item chosen from the first pull down menu. > > > > > > I can do two lists seperately, but I need the second pull down menu to be > > > a result of the first, and I can't figure a way to do it in PHP without > > > reloading the page, which I don't really want to do. > > > > > > Is this a javascript-dependent function, in that a js will have to make > > > the call to the database via some sort of scripted php/mysql request? I > > > really like to avoid javascript if possible, but I'm unsure there's an > > > alternative. > > > > You're describing what I think is called "Dynamic Options". Doing a Google > > for "javascript dynamic option" or "javascript dynamic select" will pull-up > > a few examples. > > > > Most of these solutions will expect you to load all data into javascript > > arrays. In other words, you don't have to reload the page, because all of > > the data is already present. > > > > This approach doesn't work well when dealing with large amounts of data. If > > you're running into this, use javascript's window.opener feature. It allows > > you to spawn a second window that retrieves data and sends it to the first > > window. Cripes! People are a bit slow today... what you are describing sounds like a hierselect to me: In pear,... http://pear.php.net/package/HTML_QuickForm/docs/3.2.1/HTML_QuickForm/_HTML_QuickForm-3.2.1_QuickForm_hierselect_php.html If you want to do it yourself just look at their code and get your inspiration from there - and yes, their solution is javascript based. Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help: First Time Form with Sessions
see interspered again ;) From: Stuart Felenstein <[EMAIL PROTECTED]> To: Bastien Koert <[EMAIL PROTECTED]>, [EMAIL PROTECTED] Subject: RE: [PHP-DB] Help: First Time Form with Sessions Date: Fri, 8 Oct 2004 08:56:48 -0700 (PDT) See interspersed: --- Bastien Koert <[EMAIL PROTECTED]> wrote: > Hi Stu > > 1. why not check it on every page, then if it fails > the user won't need to > make it to the end and then have to go back to the > beginning to fix > something minor. > > 2. You could use hidden fields to pass the data back > and for or just use a > session, otherwise the variables expire on that page I think I'm stuck on sessions now :) . So if there were 3 pages and then a final 4th page where the transactions to the database take place - without passing the session variables around , they will still be available on the 4th page ? yes, you will have them available...to add new elements to the session, you will need to put session-start(); on each page THAT REQUIRES sessions 3 - Now I've run into an error: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/lurkkcom/public_html/Multi2Return.php:2) in /home/lurkkcom/public_html/Multi2Return.php on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/lurkkcom/public_html/Multi2Return.php:2) in /home/lurkkcom/public_html/Multi2Return.php on line 3 You have some additional output here...could be a blank line, a cookie or html output to the browser...CAN COME from an INCLUDE file, check it out... On first page: I have session_start(); And on "Multi2Return.php" I have session_start(); I thought to continue session you need to put the session_start function on each page. If I remove though , I get nothing. Yes, you do need it on each page that uses session variables Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Take charge with a pop-up guard built on patented Microsoft® SmartScreen Technology. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help: First Time Form with Sessions
Yes, right before you answered this I found out about the first line of code by googling. My apologies. Stuart --- "Murray @ PlanetThoughtful" <[EMAIL PROTECTED]> wrote: > Hi Stuart, > > session_start() has to be the first actual codeline > in your page. > > So: > >session_start() > /* rest of code */ > ?> > > > Etc... > > On the page you're receiving the error on, move > "session_start()" to the > first line executed in the script. > > Much warmth, > > Murray > http://www.planetthoughtful.org > Building a thoughtful planet, > One quirky comment at a time. > > > -Original Message- > From: Stuart Felenstein [mailto:[EMAIL PROTECTED] > Sent: Saturday, 9 October 2004 1:57 AM > To: Bastien Koert; [EMAIL PROTECTED] > Subject: RE: [PHP-DB] Help: First Time Form with > Sessions > > See interspersed: > --- Bastien Koert <[EMAIL PROTECTED]> wrote: > > > Hi Stu > > > > 1. why not check it on every page, then if it > fails > > the user won't need to > > make it to the end and then have to go back to the > > beginning to fix > > something minor. > > > > 2. You could use hidden fields to pass the data > back > > and for or just use a > > session, otherwise the variables expire on that > page > > I think I'm stuck on sessions now :) . So if there > were 3 pages and then a final 4th page where the > transactions to the database take place - without > passing the session variables around , they will > still > be available on the 4th page ? > > 3 - Now I've run into an error: > Warning: session_start(): Cannot send session cookie > - > headers already sent by (output started at > /home/lurkkcom/public_html/Multi2Return.php:2) in > /home/lurkkcom/public_html/Multi2Return.php on line > 3 > > Warning: session_start(): Cannot send session cache > limiter - headers already sent (output started at > /home/lurkkcom/public_html/Multi2Return.php:2) in > /home/lurkkcom/public_html/Multi2Return.php on line > 3 > > On first page: > I have session_start(); > > And on "Multi2Return.php" I have session_start(); > > I thought to continue session you need to put the > session_start function on each page. If I remove > though , I get nothing. > > Stuart > > -- > 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] Help: First Time Form with Sessions
Hi Stuart, session_start() has to be the first actual codeline in your page. So: Etc... On the page you're receiving the error on, move "session_start()" to the first line executed in the script. Much warmth, Murray http://www.planetthoughtful.org Building a thoughtful planet, One quirky comment at a time. -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: Saturday, 9 October 2004 1:57 AM To: Bastien Koert; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Help: First Time Form with Sessions See interspersed: --- Bastien Koert <[EMAIL PROTECTED]> wrote: > Hi Stu > > 1. why not check it on every page, then if it fails > the user won't need to > make it to the end and then have to go back to the > beginning to fix > something minor. > > 2. You could use hidden fields to pass the data back > and for or just use a > session, otherwise the variables expire on that page I think I'm stuck on sessions now :) . So if there were 3 pages and then a final 4th page where the transactions to the database take place - without passing the session variables around , they will still be available on the 4th page ? 3 - Now I've run into an error: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/lurkkcom/public_html/Multi2Return.php:2) in /home/lurkkcom/public_html/Multi2Return.php on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/lurkkcom/public_html/Multi2Return.php:2) in /home/lurkkcom/public_html/Multi2Return.php on line 3 On first page: I have session_start(); And on "Multi2Return.php" I have session_start(); I thought to continue session you need to put the session_start function on each page. If I remove though , I get nothing. Stuart -- 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] Help: First Time Form with Sessions
> Warning: session_start(): Cannot send session cookie - > headers already sent by (output started at > /home/lurkkcom/public_html/Multi2Return.php:2) in > /home/lurkkcom/public_html/Multi2Return.php on line 3 read a little more about sessions. session_start is trying to set a cookie but output has already started, giving you this warining. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help: First Time Form with Sessions
See interspersed: --- Bastien Koert <[EMAIL PROTECTED]> wrote: > Hi Stu > > 1. why not check it on every page, then if it fails > the user won't need to > make it to the end and then have to go back to the > beginning to fix > something minor. > > 2. You could use hidden fields to pass the data back > and for or just use a > session, otherwise the variables expire on that page I think I'm stuck on sessions now :) . So if there were 3 pages and then a final 4th page where the transactions to the database take place - without passing the session variables around , they will still be available on the 4th page ? 3 - Now I've run into an error: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/lurkkcom/public_html/Multi2Return.php:2) in /home/lurkkcom/public_html/Multi2Return.php on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/lurkkcom/public_html/Multi2Return.php:2) in /home/lurkkcom/public_html/Multi2Return.php on line 3 On first page: I have session_start(); And on "Multi2Return.php" I have session_start(); I thought to continue session you need to put the session_start function on each page. If I remove though , I get nothing. Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help: First Time Form with Sessions
Hi Stu 1. why not check it on every page, then if it fails the user won't need to make it to the end and then have to go back to the beginning to fix something minor. 2. You could use hidden fields to pass the data back and for or just use a session, otherwise the variables expire on that page $fieldname1 = $_REQUEST['fieldname1']; //check field name for data correctness (regex or however you want to) $_SESSION['user_input']['fieldname1']=$fieldname1; ... $_SESSION['user_input']['fieldname3']=$fieldnameN; The above is a 2-d array, that way if you are using other session vars, you won't get confused when deciding which one holds the data that you need. hth bastien From: Stuart Felenstein <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: [PHP-DB] Help: First Time Form with Sessions Date: Fri, 8 Oct 2004 06:23:09 -0700 (PDT) Okay , so I'm working on the multi page form. Insert into DB will come at the last page. Couple of things I want to confirm: 1-Each page should have validiation for each field. Probably doesn't make any sense to wait for last page ? or maybe ? Below is the first page of the form: I only have the echo statements in there now to check and make sure the variables were taking from the form fields. Question though - when I go onto the next page, do I need to echo the variables to retain the values or just keep the variables listed ? In other words as I continue through the next form pages, do I need to echo the previous ones ? "; echo "\$AltP1 = ".$AltP1.""; echo "\$AltP2 = ".$AltP2.""; echo "\$Pgr = ".$Pgr.""; echo "\$El2 = ".$El2.""; echo "\$El3 = ".$El3.""; ?> Thank you , Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Take charge with a pop-up guard built on patented Microsoft® SmartScreen Technology http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help: First Time Form with Sessions
Okay , so I'm working on the multi page form. Insert into DB will come at the last page. Couple of things I want to confirm: 1-Each page should have validiation for each field. Probably doesn't make any sense to wait for last page ? or maybe ? Below is the first page of the form: I only have the echo statements in there now to check and make sure the variables were taking from the form fields. Question though - when I go onto the next page, do I need to echo the variables to retain the values or just keep the variables listed ? In other words as I continue through the next form pages, do I need to echo the previous ones ? "; echo "\$AltP1 = ".$AltP1.""; echo "\$AltP2 = ".$AltP2.""; echo "\$Pgr = ".$Pgr.""; echo "\$El2 = ".$El2.""; echo "\$El3 = ".$El3.""; ?> Thank you , Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Importing Excel and Access data to MySQL
The best way I have found is convert the data to a comma separated value file, use phpMyAdmin and insert the data into you database. A couple of things that you have to watch out for is the number of records that you are importing and that all your fields in your DB are of the correct format and length. Mark A. Bomgardner Technology Specialist KLETC -Original Message- From: Matthew Perry [mailto:[EMAIL PROTECTED] Sent: Thursday, October 07, 2004 9:46 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Importing Excel and Access data to MySQL Simple question, How does one import excel and access data to MySQL? -- Matthew Perry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: php_mysql.dll (5.0.2) and libmysql.dll (4.0.20a) incompatibilities
Hi. I do copy it to my Apache directory and it seems is ok now. but I can not connect to database (php know the functions but raise error and say my client is old) I force use mysqli in replace of mysql functions. and it work. Is there any one know better solution? Regards, Sadeq On Thu, 07 Oct 2004 11:47:55 -0400, Glenn Puckett <[EMAIL PROTECTED]> wrote: > I just went through this myself. PHP v5x comes with the correct > libmysql.dll. Copy that to System32 and it will work. I haven't used > it enough yet to know if it causes problems with MySQL, but PHP now works. > > > > Steve Olney wrote: > > Hi, > > > > I have an incompatibility problem when trying to use PHP 5.0.2 with an > > installation of MySQL version 4.0.20a. The problem seems to be as follows: > > > > The php_mysql.dll file is compiled with support for two MySQL function calls > > (from the API) namely: mysql_drop_db and mysql_create_db (which are noted in > > the MySQL documentation as being deprecated for MySQL versions at least > > greater than 4.0.13 (the version I have installed at home)) but these > > functions are no longer compiled into the libmysql.dll (as of 4.x), > > obviously as these are deprecated MySQL have phased them out of the build of > > libmysql.dll. > > > > As of PHP 5.x I believe that you are required to obtain the libmysql.dll > > from the MySQL distribution as it's not in the php distribution, but this > > obviously poses as problem if you are working with a 4.x MySQL > > installation - the above incompatibility problem. > > > > Has anybody come across a solution to this problem apart from the obvious, > > recompiling the various lib's to remove this incompatibility (I'm thinking > > here that there might be compiled versions of the lib's out there that are > > 'fixed') ? > > > > I'll check back soon to see if there are any solutions but in the meantime > > will attempt to 'fix' the problems with a recompile (which could take me > > some time as I need to install a compiler, the source, make the edits and > > test). I'll post my results. > > > > Thanks, > > > > Steve > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php