RE: [PHP-DB] Why does this conditional run, even if not true?
Bastien, Thanks for your reply (and on the weekend, no less!). I went back and looked and the function does return only YES or NO so that wasn't the problem. What I found to be the problem was that my while loop inside the IF clause was running no matter what. So what I did was put the while loop in it's own function and voila! no more problems. PHP is funny. It seems to trip on it's own shoestrings sometimes. (either that or I didn't RTFM) :) Cheers, Karen Bastien Koert [EMAIL PROTECTED] wrote: 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 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! - Do you Yahoo!? vote.yahoo.com - Register online to vote today!
[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 brField 2 of array 2 text row: .$field2array[2].br; echo brField 9 of array 1 text row: .$fieldarray[$c].br; $acceptOrReject = R; $displayrows.=font color=redbSee below: Original Sample ID for Repeat does not exist : .$fieldarray[$c]./b/fontbr; } } //end of while loop fclose($handle2); }//end of If($reject ==No) - Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish.
[PHP-DB] Totally lost on why If statement doesn't work to call query
This works: If(C==C) { //query and display here } This works: If(C==D) { //query and display here (won't happen) } In other words the query inside the If clause runs or not, depending on the logic. But, when I initialize $z=odbc_result($data5,SystemType); and $thissystem=C then this doesn't work: If($z==$thissystem) { //query and display here } I've echoed all the values to the page to make sure they are there. What the heck is going on? (please) Here is the whole block of code that runs or doesn't. I've spent hours trying to figure out why it doesn't work even when the code itself without the If statement works: $data5=odbc_do($connectionSDS,SELECT SystemType FROM orweb.dbo.InventoryTiny WHERE PWS='$pwsno'); $z=odbc_result($data5,SystemType); $thissystem=C; echo $z; //returns C echo br; echo $thissystem; //returns C echo br; If($z==$thissystem) { $data6=odbc_do($connectionSDWIS,EXEC orweb.jdavis.sp_CCR '$pwsno'); echo table width=70%\n; echo th colspan=3 bgcolor=lightblueConsumer Confidence Reports/th; echo $trcenter; echo tdubFor Year/b/u/tdtdubDate Received/b/u/tdtdubDate Certified/b/u/td; echo /tr; do { echo $trcenter; $fields=odbc_num_fields($data6); for($i=1 ; $i=$fields ; $i++) echo td nowrap.odbc_result($data6,$i)./td; echo /tr\n; } while(odbc_fetch_row($data6)); echo /table; } echo (Only Community water systems require a Consumer Confidence Report); - Do you Yahoo!? vote.yahoo.com - Register online to vote today!
Re: [PHP-DB] Totally lost on why If statement doesn't work to call query
whoa! It looks like a space. no? results of echo var_dump($z): string(4) C I'll try a trim statement. thanks! John Holmes [EMAIL PROTECTED] wrote: From: Karen Resplendo $data5=odbc_do($connectionSDS,SELECT SystemType FROM orweb.dbo.InventoryTiny WHERE PWS='$pwsno'); $z=odbc_result($data5,SystemType); $thissystem=C; echo $z; //returns C echo ; echo $thissystem; //returns C echo ; If($z==$thissystem) Try var_dump($z) to see if there are any extra characters returned in $z. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers!
Re: [PHP-DB] Connect to a ms access on a remote drive
How about mapping a drive on the web server to the folder where the MS Access mdb is? Need to give the web user account permissions. Then all you have to do is reference the mapped drive in the path, I believe. Not sure of the security ramifications here, however. Robert Twitty [EMAIL PROTECTED] wrote:Assuming your PHP script is located on a Win32 server, you will have to run the web server under a user account that has permission to access the remote drive. You then have to reference the MS Access database by its UNC path. -- bob On Mon, 2 Aug 2004, Paul Kain wrote: I am aware that theres a problem with connecting to an MS ACCESS DB on a remote drive. Anyoone how to do it correctly ? Please? :( -- 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 __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: [PHP-DB] PHP use in Federal Govt
http://170.104.158.16/inventory.php3 enter 00100 to get to Bend, OR water system info Galbreath, Mark A [EMAIL PROTECTED] wrote: Alls, My division at State is trying to get PHP 5.0 approved for use by developers in the Department, and the Powers That Be are requesting evidence that other Federal agencies/military are using PHP, and the extent of it's use. Anybody have a clue about this? I sure would appreciate some help! tia, Mark -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish.
[PHP-DB] Date problem: data is current as of yesterday
The database queries all the sources at night after everyone has gone home. That means the data was current as of yesterday. This little snippet below returns yesterday's date, except that the first day of the month returns 0 for the day. Now, I know why this is happening, but I can't find out how to fix it (in VBA or SQL Server I would just say, date()-1: $today = getdate(); $month = $today['month'] ; $mday = $today['mday'] -1; $year = $today['year']; echo Data is current as of b$month $mday, $year/bbr; - Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage!
[PHP-DB] Pulldown value not passed to next page
What is wrong with this picture? I build a pulldown for selecting page size(number of rows in one page). If page is new, it gives the default (selected) of 15. For some reason, when Previous/Next are clicked, the value passed is still 15 even though the pulldown says something else (5 or 15 or whatever). Down below my pulldown code is the code to call the Next/Previous pages (just the important part) ** Pulldown built here ** //use rcan select page size from a pulldown $myArray = array('5','10','15','20','25','30','35', '40'); $numElements = count($myArray); If(!$pagesize) { $pagesize=15; } echo SELECT SIZE=1 NAME='pagesize'; /*loop through filling pulldown*/ for($i=0;$i=$numElements;$i++){ echo OPTION VALUE=.$myArray[$i]; If($myArray[$i]==$pagesize) { echo SELECTED.$myArray[$i].\n; } Else { echo .$myArray[$i].\n; } } echo /SELECTbrbr; link when Next/Previous clicked *** else// not the last page, link to the next page echo a href=\chemlatestPAGETEST.php3?pwsno=.$pwsno.pagenum= . ($pagenum + 1).pagesize=.$pagesize. \Next/a; - Do you Yahoo!? Yahoo! Search - Find what youre looking for faster.
RE: [PHP-DB] Query to Array to Echo Problem--Thank you
Yes! That worked! (It was returning the same field values not column names, my mistake). Now it returns what it should return. Onwards to the next snafu! Thanks! Ryan Jameson (USA) [EMAIL PROTECTED] wrote: One thing may be that you need to do a fetch to increment the result row odbc_fetch_row($result);. Though that doesn't explain your column names being in the array unless that's what's in the table. Ryan -Original Message- From: Karen Resplendo [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 24, 2004 5:18 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Query to Array to Echo Problem Here is the webpage that demonstrates my code problem: http://170.104.158.16/chemlatestPAGETEST.php3?pwsno=00100 I'm so close I can smell it. Hoping someone can troubleshoot my code. Here is the piece that doesn't work. It returns the 2 column names, over and over. For some reason I'm not loading the values from the query. (Using only 2 columns for now and hardcoding number of rows): function QueryIntoArray($query){ settype($retval,array); /* connect to sdwis server*/ $connectionSDWIS = odbc_connect(,,); if(!$connectionSDWIS) die(Couldn't connect); /* select sdwis database */ odbc_do($connectionSDWIS, use ); $result= odbc_do($connectionSDWIS,$query); if(!$result){ print Query Failed; } for($i=0;$i100;$i++){ $fields=odbc_num_fields($result); for($j=1;$j $fields;$j++){ $retval[$i][odbc_field_name($result,$j)] = odbc_result($result,$j); }//end inner loop }//end outer loop return $retval; }//end function $query = SELECT DISTINCT PWS, PWSName, CONVERT(varchar(12), DateCollected, 101), AnalyteName, SourceID, str(Results,7,4), str(MCL, 7,4), UOM, DateCollected FROM ChemMon WHERE PWSID='00100' AND AnalyteCode NOT IN('3013','3014','3100') ORDER BY DateCollected DESC, AnalyteName ; settype($myresult,array); $myresult = QueryIntoArray($query); for($i=0;$i print $myresult[$i][AnalyteName]; print $myresult[$i][UOM]; } - Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want.
Re: [PHP-DB] Re: Stored procedure with UNION---no unique id, how to page?
Found the answer to the first part of my question: SELECT D_Num = IDENTITY(int, 1, 1),* INTO temptable FROM someViewOrTable Frank Flynn [EMAIL PROTECTED] wrote: On 2/19/04 4:09 PM, [EMAIL PROTECTED] wrote: From: Karen Resplendo Date: Thu, 19 Feb 2004 11:37:48 -0800 (PST) To: [EMAIL PROTECTED] Subject: Stored procedure with UNION---no unique id, how to page? I have a stored procedure in msSQL that UNIONs 3 queries. There is no unique identifier that is sequential that I can use to page on webpage because the data comes from different tables/databases. Is there a way to save the resultset into a temp table and add an @@Identity(autonumber) to it? From that I can select Top 50, greater than last ID, etc, to do my pageing on web page? The resultset is pretty unique to what the user wants, so it can only be used by that session. I hope my problem(database) is understandable. Here is the stored procedure code, just in case: CREATE PROCEDURE sp_MarkerChemSummary @vPWS varchar(5) Stored Proc deleted You can, do this (... save the resultset into a temp table...) but it's more complicated or you can run the whole thing each time and have PHP decide which rows to show as you page through the results. If the stored proc is quick (low impact on the DB) I'd suggest doing the latter - return all of the rows to PHP, have PHP display the first 10 rows and have the Next 10 button be the submit button of a form with all the same fields you need to re-run the same query (all hidden) and an off-set field (which in this example would have 10 in it now). Run the query again and don't print the first 10 rows - then print 10 - then repeat the trick with the Next 10 button (which now has the offset of 20)... If the stored Proc is something you don't want to run over and over again do as you suggest. But you can't use a temp table though because it will get confused and if you connect to the DB on a different connection those results will not be there. (temp tables are pre user and get blown away when you disconnect). It might work in development but if you scale this to two web servers you could break this. So here's how I'd do it: Create a regular table with the columns you expect from the SP, and an identity column, a web_user (int) and a datetime column. Have the Stored proc: - delete from this table where your new datetime column is over 6 hours old (all the old data), you need to do this or the table will overflow. - figure a random number that is not in this table (this is your web_user column). - load this table set the web_user to the random number and the datetime column to now in MS SQL getdate(). - Have your Stored Proc return only the web_user value to PHP. Now run a new query on the table where web_user = the value you just got. Your Next 10 button only needs to store the web_user value and the number of the row you're on now. If you need some sample code I can send you some but really it's pretty straight forward in the PHP side. Good Luck, Frank -- Frank Flynn Poet, Artist Mystic -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want.
[PHP-DB] Query to Array to Echo Problem
Here is the webpage that demonstrates my code problem: http://170.104.158.16/chemlatestPAGETEST.php3?pwsno=00100 I'm so close I can smell it. Hoping someone can troubleshoot my code. Here is the piece that doesn't work. It returns the 2 column names, over and over. For some reason I'm not loading the values from the query. (Using only 2 columns for now and hardcoding number of rows): function QueryIntoArray($query){ settype($retval,array); /* connect to sdwis server*/ $connectionSDWIS = odbc_connect(,,); if(!$connectionSDWIS) die(Couldn't connect); /* select sdwis database */ odbc_do($connectionSDWIS, use ); $result= odbc_do($connectionSDWIS,$query); if(!$result){ print Query Failed; } for($i=0;$i100;$i++){ $fields=odbc_num_fields($result); for($j=1;$j $fields;$j++){ $retval[$i][odbc_field_name($result,$j)] = odbc_result($result,$j); }//end inner loop }//end outer loop return $retval; }//end function $query = SELECT DISTINCT PWS, PWSName, CONVERT(varchar(12), DateCollected, 101), AnalyteName, SourceID, str(Results,7,4), str(MCL, 7,4), UOM, DateCollected FROM ChemMon WHERE PWSID='00100' AND AnalyteCode NOT IN('3013','3014','3100') ORDER BY DateCollected DESC, AnalyteName ; settype($myresult,array); $myresult = QueryIntoArray($query); for($i=0;$icount($myresult);$i++){ print $myresult[$i][AnalyteName]; print $myresult[$i][UOM]; } - Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want.
[PHP-DB] Stored procedure with UNION---no unique id, how to page?
I have a stored procedure in msSQL that UNIONs 3 queries. There is no unique identifier that is sequential that I can use to page on webpage because the data comes from different tables/databases. Is there a way to save the resultset into a temp table and add an @@Identity(autonumber) to it? From that I can select Top 50, greater than last ID, etc, to do my pageing on web page? The resultset is pretty unique to what the user wants, so it can only be used by that session. I hope my problem(database) is understandable. Here is the stored procedure code, just in case: CREATE PROCEDURE sp_MarkerChemSummary @vPWS varchar(5) AS /*== */ SELECT SamplingGroup = CASE TSAANLYT.CODE WHEN '1040' THEN 'NITRATE' WHEN '1035' THEN 'IOC' WHEN '2987' THEN 'VOC' WHEN '1094' THEN 'ASB' WHEN '2050' THEN 'SOC' WHEN '1005' THEN 'ARS' WHEN '1041' THEN 'NITRITE' WHEN '4000' THEN 'RADS' END, CONVERT(varchar(12),TSASAMPL.COLLLECTION_END_DT, 107) AS SampDateText, TINWSF.ST_ASGN_IDENT_CD AS EorSID, TINWSF.NAME AS EorSname, CONVERT(varchar(12),TSASAMPL.D_FIRST_IDENTED_TS,107) AS RecvDate, TSAANLYT.CODE AS AnalyteCode, TSASAMPL.COLLLECTION_END_DT AS SampDate FROM orv80.dbo.TINWSF TINWSF LEFT OUTER JOIN orv80.dbo.TINWSYS TINWSYS ON TINWSF.TINWSYS_IS_NUMBER = TINWSYS.TINWSYS_IS_NUMBER AND TINWSF.TINWSYS_ST_CODE = TINWSYS.TINWSYS_ST_CODE RIGHT OUTER JOIN orv80.dbo.TSAANLYT TSAANLYT INNER JOIN orv80.dbo.TSASAR TSASAR ON TSASAR.TSAANLYT_IS_NUMBER = TSAANLYT.TSAANLYT_IS_NUMBER INNER JOIN orv80.dbo.TSASAMPL TSASAMPL ON TSASAMPL.TSASAMPL_IS_NUMBER = TSASAR.TSASAMPL_IS_NUMBER AND TSASAMPL.TSASAMPL_ST_CODE = TSASAR.TSASAMPL_ST_CODE ON TINWSYS.TINWSYS_IS_NUMBER = TSASAMPL.TINWSYS_IS_NUMBER AND TINWSYS.TINWSYS_ST_CODE = TSASAMPL.TINWSYS_ST_CODE WHERE (TSAANLYT.CODE IN ('1040', '1035', '2987', '1094', '2050', '1005', '1041','4000')) AND (TINWSF.TYPE_CODE IN ('SS', 'DS')) AND (TINWSF.ACTIVITY_STATUS_CD = 'A') AND [EMAIL PROTECTED] AND ( (TSASAR.DATA_QUALITY_CODE = 'V') AND (TSASAR.CONCENTRATION_MSR = 1) OR (TSASAR.DATA_QUALITY_CODE = 'V') AND (TSASAR.CONCENTRATION_MSR = 0) OR (TSASAR.DATA_QUALITY_CODE = 'A') AND (TSASAR.CONCENTRATION_MSR = 0)) --ORDER BY TSASAMPL.COLLLECTION_END_DT DESC, TSAANLYT.CODE ASC End of Marker Chems for SDWIS (ORV80) UNION --Beginning of MARKER CHEMS FOR ORARCHIVE - Asbestos SELECT 'Asbestos' AS SamplingGroup, CONVERT(varchar(12),SampDate,107) AS SampDateText, 'DIST-A' AS EorSID, 'Distribution A' as EorSname, CONVERT(varchar(12), RecvDate,107), '1094' AS AnalyteCode, SampDate FROM ORARCHIVE.DBO.Asbestos ASBESTOS WHERE [EMAIL PROTECTED] /*=--ORDER BY SampDate DESC, TESTSUITE DESC== Beginning of MARKER CHEMS FOR ORARCHIVE - Asbestos =*/ UNION (SELECT SamplingGroup = CASE CHEMMON2.ContamID WHEN '1040' THEN 'NITRATE' WHEN '1035' THEN 'IOC' WHEN '2987' THEN 'VOC' WHEN '1094' THEN 'ASB' WHEN '2050' THEN 'SOC' WHEN '1005' THEN 'ARS' WHEN '1041' THEN 'NITRITE' WHEN '4000' THEN 'RADS' END, CONVERT(varchar(12),SampDate,107) AS SampDateText, EORSID = CASE LEN(CHEMMON2.EORSID ) WHEN 1 THEN 'EP-'+ LEFT (CHEMMON2.EORSID,1) WHEN 2 THEN 'SRC-'+ LEFT(CHEMMON2.EORSID,1) END, EorSName, CONVERT(varchar(12), RecvDate, 107), ContamID AS AnalyteCode,SampDate FROM ORARCHIVE.DBO.CHEMMON2 CHEMMON2 WHERE CHEMMON2.ContamID IN ('1040', '1035', '2987', '1094', '2050', '1005', '1041','4000') AND [EMAIL PROTECTED] ) ORDER BY EorSID ASC, SamplingGroup ASC, SampDate DESC GO - Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want.
[PHP-DB] Paging large recordsets
I guess the time has come that my boss wants Next, Previous, First, Last paging for our data displays of large recordsets or datasets. Any good solutons out there already? I have pieces of a few examples. Also, how to deal with printing? I would assume that the ideal page size is not the ideal printed page size. oi vay! TIA - Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online
[PHP-DB] Extra blank lines bomb fgetcsv function
Here is the beginning of a big loop that loads a line at a time from an uploaded textfile and then runs validation on each field: //loop through the rows putting the fields into an array while ($fieldarray = fgetcsv ($handle, $userfile_size, ,)) { The problem I am having is that when there is an empty line at the bottom of the txt file, my validation tells me it is a bad line, and rejects the file. Is there anyway of stopping the loop, or trimming the file of empty lines? Hope I've explained my problem correctly. - Do you Yahoo!? Free Pop-Up Blocker - Get it now
[PHP-DB] testing--no message
no message! - Do you Yahoo!? Free Pop-Up Blocker - Get it now
[PHP-DB] CONVERT STRING VARIABLES TO DATES, THEN COMPARE (HOW?)
Apache on NT using MS SQL Srvr 2000 PHP 4.03pl1 I return these dates into strings and now I want to compare my database date to see if it is later than today's date. Pretty sure my Expires field is a string: Here is the Expires field from the SQL: Convert(varchar, DATEADD(Year,3,DateCertified),101) AS Expires Here is my PHP code trying to compare dates: $today = date(m/d/Y); If ($today odbc_result($data,Expires)) { echo brbrLicense has expiredbrbr; } Else { echo brbrLicense has not expiredbrbr; } Sure could use a simple solution to a simple problem that has me simply confounded. - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard
Re: [PHP-DB] CONVERT STRING VARIABLES TO DATES, THEN COMPARE (HOW?)
Yes, the values echo out the way I expect them. But these are displayed values, not dates, I'm pretty sure, and that is why the comparison is failing. The question began very simply. I will try to make it simpler: How do I compare a string date from a database to today's date using PHP? I can do it with my eyes closed in SQL. I don't want to if I can avoid it. Jason Wong [EMAIL PROTECTED] wrote: On Saturday 08 November 2003 02:44, Karen Resplendo wrote: Apache on NT using MS SQL Srvr 2000 PHP 4.03pl1 I return these dates into strings and now I want to compare my database date to see if it is later than today's date. Pretty sure my Expires field is a string: Here is the Expires field from the SQL: Convert(varchar, DATEADD(Year,3,DateCertified),101) AS Expires Here is my PHP code trying to compare dates: $today = date(m/d/Y); If ($today odbc_result($data,Expires)) { echo License has expired ; } Else { echo License has not expired ; } Sure could use a simple solution to a simple problem that has me simply confounded. Why not just do the comparison directly within the query? And if you want to get the above working, have you tried debugging it? Like: print($today); print(odbc_result($data,Expires)); Are they what you expected them to be? -- 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 -- /* Alaska: A prelude to No. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard
Re: [PHP-DB] CONVERT STRING VARIABLES TO DATES, THEN COMPARE (HOW?)
Education :) (it seems like such a simple thing to do, to look up, to have in someone's library of code, yet. . . . . . .) I can do it with my eyes closed in SQL. I don't want to if I can avoid it. It's more efficient to do so, so can I ask why you want to avoid it? -- 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 -- /* A truth that's told with bad intent Beats all the lies you can invent. -- William Blake */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard
[PHP-DB] Strtotime works for date comparisons on nonUnix--thank you :)
$today = Strtotime(date(m/d/Y)); $expires=Strtotime(odbc_result($data,Expires)); If ($today = $expires) { echo brbrLicense has not expiredbrbr; } Else { echo brbrLicense has expiredbrbr; } :-P - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard
RE: [PHP-DB] Can't copy file to another server
Gonna have to check that one. Who gets this permission might I ask? I'm told the PHP process is running under Administrator, so . . . . . . . . .is there any way to tell for sure? (by the way, your posts come through as triplicates) [EMAIL PROTECTED] wrote: A simple thing, but do you have wrte permission on your drive F: from the web server? -Original Message- From: Karen Resplendo [mailto:[EMAIL PROTECTED] Sent: 23 October 2003 22:18 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Can't copy file to another server Nope. Already tried that. Warning: Unable to create 'F:/portlandApr05-08-2002.txt': Permission denied in C:/Program Files/Apache13 14/Apache/htdocs/file_upload.php3 on line 172 [EMAIL PROTECTED] wrote: do you just need a / $AcceptedFolder= 'F:/'; Karen Resplendo ahoo.com cc: Subject: [PHP-DB] Can't copy file to another server 10/23/2003 02:22 PM Apache on Windows web server. After file upload and validation I would like to copy it to a folder on a Win 2K Server machine. We have created the folder and shared it and mapped a drive(F:) on the Webserver to it: $AcceptedFolder= 'F:'; $AcceptedFileAndPath=$AcceptedFolder.$HTTP_POST_FILES['userfile']['name']; copy($uploadfileandpath,$AcceptedFileAndPath); We get this error: Warning: Unable to create 'F:Apr05-08-2002.txt': Permission denied in C:/Program Files/Apache13 14/Apache/htdocs/file_upload.php3 on line 165 Sure could use some help. - Do you Yahoo!? The New Yahoo! Shopping - with improved product search -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? The New Yahoo! Shopping - with improved product search -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
[PHP-DB] Still can't copy file to remote server
I've been able to do using the Command Prompt on the webserver where PHP is housed, but it doesn't work in PHP: $cmd= 'cmd /c copy C:\Program Files\Apache13 14\Apache\htdocs\AsciiCheck\a.txt F:\ '; print $cmd.br; passthru($cmd); This is the output on the php page: cmd /c copy C:\Program Files\Apache13 14\Apache\htdocs\AsciiCheck\a.txt F:\ 0 file(s) copied. NET USE doesn't work either: $cmd= 'NET USE G: \\110.154.138.27\AsciiUploads xxxng /USER:tess '; print $cmd.br; passthru($cmd); I - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
[PHP-DB] Can't copy file to another server
Apache on Windows web server. After file upload and validation I would like to copy it to a folder on a Win 2K Server machine. We have created the folder and shared it and mapped a drive(F:) on the Webserver to it: $AcceptedFolder= 'F:'; $AcceptedFileAndPath=$AcceptedFolder.$HTTP_POST_FILES['userfile']['name']; copy($uploadfileandpath,$AcceptedFileAndPath); We get this error: Warning: Unable to create 'F:Apr05-08-2002.txt': Permission denied in C:/Program Files/Apache13 14/Apache/htdocs/file_upload.php3 on line 165 Sure could use some help. - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
Re: [PHP-DB] Can't copy file to another server
Nope. Already tried that. Warning: Unable to create 'F:/portlandApr05-08-2002.txt': Permission denied in C:/Program Files/Apache13 14/Apache/htdocs/file_upload.php3 on line 172 [EMAIL PROTECTED] wrote: do you just need a / $AcceptedFolder= 'F:/'; Karen Resplendo ahoo.com cc: Subject: [PHP-DB] Can't copy file to another server 10/23/2003 02:22 PM Apache on Windows web server. After file upload and validation I would like to copy it to a folder on a Win 2K Server machine. We have created the folder and shared it and mapped a drive(F:) on the Webserver to it: $AcceptedFolder= 'F:'; $AcceptedFileAndPath=$AcceptedFolder.$HTTP_POST_FILES['userfile']['name']; copy($uploadfileandpath,$AcceptedFileAndPath); We get this error: Warning: Unable to create 'F:Apr05-08-2002.txt': Permission denied in C:/Program Files/Apache13 14/Apache/htdocs/file_upload.php3 on line 165 Sure could use some help. - Do you Yahoo!? The New Yahoo! Shopping - with improved product search -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
Re: [PHP-DB] Urgent help needed
In the input definition onclick call a javascript function with all your parameters. Might be a missing quote here and there but this is close to ones I use all the time: echo brinput type=button value = \Go\ onClick=\yourjavascriptfunction('$parameter1','$parameter2','$parameter3')\; Now here is what is in yourjavascriptfunctio('$parameter1,$parameter2,$parameter3'): function yourjavascriptfunction(this1,this2,this3) { window.open(proofexcel.php3?batch_id= + window.document.forms(0).LabBatchPicker.value + parameter1= + this1 +parameter2=+ this2 + parameter3= + this3 ); return true; } Lots of different ways you can do this. Let me know Chris Payne [EMAIL PROTECTED] wrote: Hi there everyone, I have this system where you can create folders on your HD for inserting PDF files via a web interface and you can also remove these folders, this works no problem, but I have run into a snag, I need to send more than 1 field in the below array via a form, how can I do? Basically, aswell as sending the ID, I need to send the title and path too and i'm abit confused. [input] name=del[] Any help would be VERY appreciated :-) Thanks everyone. Chris - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
[PHP-DB] How do I get quotes around strings to display?
My ascii file coming in has quotes around each comma delimited item. After reading the rows into array these quotes are gone. Can't figure out how to put them back in the array items when displaying the fields. Rows are saved to table and bad rows are displayed in browser. Hope this fits this list: // //now print out the fields in one row //don't print last comma in row of fields For ($c=0; $c $fieldcount; $c++) { if ($c==10) { $displayrows.=$fieldarray[$c]; } Else { $displayrows.=$fieldarray[$c].,; } } //end of for loop - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
[PHP-DB] How can I tell if Recordset is empty using MSSQL and ODBC?
In VBscript an empty recordset returns the End of File marker: If rs.EOF Then do nothing How can I do this in PHP using MS SQL Server and ODBC drivers? Here is a peace of my code: $data= odbc_do($connectionSDWIS,SELECT LabUserName, LabName, WhichProcess FROM LabLogin WHERE LabUserName='$loginUserName' AND LabPassword='$loginPassword'); - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
[PHP-DB] How to post code and avoid spam filter in Yahoo?
I keep getting Spam warnings on this list whenever I post code. Is there anyway around this? I'm not sure my questions can be answered without showing the code that I am having trouble with. If not, then I will have to get my boss to subscribe and post from his ISP account. Karen - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
Re: [PHP-DB] fgetcsv() only returns half of the rows
Does that mean that my length setting has to be exactly the length of the row? I don't know this because it is a comma delimited file, not a space delimited. The function description says: The length parameter must be greater than the longest line to be found in the CSV file (allowing for trailing line-end characters). I removed this block where I do an fgets() and then I get all rows displayed. Also, I was mistaken about total rows. There are 123 and I only display 62, which is half, so I'm thinking something is being incremented twice instead of once. What should I set the length at?: $buffer = fgets($handle,300); $buffer = str_replace(\,,$buffer); print $buffer.br; Jason Wong [EMAIL PROTECTED] wrote: On Friday 26 September 2003 23:46, Karen Resplendo wrote: There are 113 rows in my comma delimited text file and the code below only displays 62 of them. It executes very quickly so I'm not thinking there is a time out problem. Any ideas? //here is URL with fgetcsv() explanation: http://us3.php.net/manual/en/function.fgetcsv.php $uploadthis = 'C:/AsciiTestJohn/OR100012-09252003.txt'; $row = 1; $handle = fopen ($uploadthis,r); rewind($handle); while ($fieldarray = fgetcsv ($handle, 300, ,)) { $fieldcount = count ($fieldarray); print $fieldcount fields in line $row: \n; $row++; for ($c=0; $c $fieldcount; $c++) { print $fieldarray[$c] . \n; } Your logic here seems a bit odd. In your WHILE clause you're reading chunks of 300 chars at a time. Then in the code below, you're reading in another chunk of 300 chars. Thus each iteration of the WHILE-loop reads in 600 chars from the file. Is that your real intention? $buffer = fgets($handle,300); $buffer = str_replace(\,,$buffer); print $buffer. ; } //end of while loop fclose ($handle); -- 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 -- /* ...there can be no public or private virtue unless the foundation of action is the practice of truth. - George Jacob Holyoake */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
Re: [PHP-DB] fgetcsv() only returns half of the rows
What I am trying to do: lab uploads txt file php validates file, row by row, field by field (against database) I display bad rows and reasons in red and reject file I've figured out a different way to display the whole row by just printing the array with , instead of br/n Just wondering why the row pointer was getting incremented and now I think I know why: a call to both fgetcsv() and fget() will each increment the row pointer by one. No? So, taking this out leaves only fgetcsv() to increment the rows in the text file it is looking at: /*$buffer = fgets($handle,300); $buffer = str_replace(\,,$buffer); print $buffer.br;*/ Warning: more on this later :) Jason Wong [EMAIL PROTECTED] wrote: On Saturday 27 September 2003 01:24, Karen Resplendo wrote: Does that mean that my length setting has to be exactly the length of the row? No. I don't know this because it is a comma delimited file, not a space delimited. The function description says: The length parameter must be greater than the longest line to be found in the CSV file (allowing for trailing line-end characters). So set it to [max line length]+10. I removed this block where I do an fgets() and then I get all rows displayed. Also, I was mistaken about total rows. There are 123 and I only display 62, which is half, so I'm thinking something is being incremented twice instead of once. Exactly, that block of code below is reading in another line. What is it's purpose anyway? What are you trying to achieve? What should I set the length at?: $buffer = fgets($handle,300); $buffer = str_replace(\,,$buffer); print $buffer. ; -- 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 -- /* The wise man seeks everything in himself; the ignorant man tries to get everything from somebody else. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? The New Yahoo! Shopping - with improved product search