Jump to content

mickeymouse

Members
  • Posts

    87
  • Joined

  • Last visited

Everything posted by mickeymouse

  1. Re #1: Actually, $acnm is not a numeric array. It's an array that contains the account names. $cntr is numeric. So I don't see a problem with $acnm[$cntr] and it does work. Re #2: I agree the print does not need the curly brackets, but I would think that they don't cause a problem. Anyway, thanks for spotting it and I'm removing them. Re #3: I expect that I have one of these "$amts[$cntr]=Array(0,0,0,0,0,0,0,0,0,0,0,0,0);" for each account as created by my earlier code: $cntr=0; while($cntr<$numacts) {$cntr=$cntr+1; $amts[$cntr]=Array(0,0,0,0,0,0,0,0,0,0,0,0,0); } Then with $amts[$cntr][1] to $amts[$cntr][12] I am trying to extract the 12 months in each account's array.
  2. Please tell me where all the errors and warnings are. All of it seems to work except for the last part which is the printing. // PRINT ACCOUNT FROM ACCOUNTS TABLE & // MONTHLY AMOUNTS FROM AMOUNTS TABLES // THIS IS THE PROBLEM - IT DOESN'T WORK! <------------- $cntr=0; while($cntr<$numacts) {$cntr=$cntr+1; {print("$acnm[$cntr] $amts[$cntr][1] $amts[$cntr][2] $amts[$cntr][3] $amts[$cntr][4] $amts[$cntr][5] $amts[$cntr][6] $amts[$cntr][7] $amts[$cntr][8] $amts[$cntr][9] $amts[$cntr][10] $amts[$cntr][11] $amts[$cntr][12] <br>"); } } // PRINTING RESULTS: accountA Array[1] Array[2] Array[3] ... accountB Array[1] Array[2] Array[3] ... etc for each account name entry.
  3. I don't know if an SQL query would help. For the moment, can you look at my code and see if you can identify errors. I've used this code approach in another report and it works but here, I can't make it work. Tks $acnm=array(); $acmo=0; $numacts = $AffectedRows; // LOAD ACCOUNT NAMES FROM ACCOUNTS DB TABLE // INTO ACCOUNT NAME TABLE // WORKS OK - PROVEN BY A TEST PRINT. // $row[2] is the account name index. // $row[1] is the account name. while ($row = mysql_fetch_row($Results)) {$acnm[$row[2]]=$row[1]; } //------------------------------------------- // CREATE & INITIALIZE AMOUNTS TABLES // COVERING 12 MONTHS FOR EACH ACCOUNT NAME $cntr=0; while($cntr<$numacts) {$cntr=$cntr+1; $amts[$cntr]=Array(0,0,0,0,0,0,0,0,0,0,0,0,0); } //------------------------------------------- // LOAD AMOUNTS FROM TRANSACTIONS INTO TABLES // $row[4] and $row[5] are account indexes // $row[3] is the ammount $cntr=0; while ($row = mysql_fetch_row($Results)) {$cntr=$cntr+1; $effmo = substr($row[1],5,2); //extract month from date field. $amts[$row[4]][$effmo]=$amts[$row[4]][$effmo] - $row[3]; //* $amts[$row[5]][$effmo]=$amts[$row[5]][$effmo] + $row[3]; //* } // * Should be OK as I've used this in other reports and it worked. //------------------------------------------- // PRINT ACCOUNT FROM ACCOUNTS TABLE & // MONTHLY AMOUNTS FROM AMOUNTS TABLES // THIS IS THE PROBLEM - IT DOESN'T WORK! $cntr=0; while($cntr<$numacts) {$cntr=$cntr+1; {print("$acnm[$cntr] &#160;$amts[$cntr][1] &#160;$amts[$cntr][2] &#160;$amts[$cntr][3] &#160;$amts[$cntr][4] &#160;$amts[$cntr][5] &#160;$amts[$cntr][6] &#160;$amts[$cntr][7] &#160;$amts[$cntr][8] &#160;$amts[$cntr][9] &#160;$amts[$cntr][10] &#160;$amts[$cntr][11] &#160;$amts[$cntr][12] <br>"); } } // PRINTING RESULTS: accountA Array[1] Array[2] Array[3] ... accountB Array[1] Array[2] Array[3] ... etc for each account name entry.
  4. I don't see how I can use this. I can't define $acct_a = 'company abc'; $acct_b = 'company stu'; $acct_c = 'company xyz' etc for 100 or 200 unknown accounts; nor can I define $val_1 = 35; $val_2 = 1007; $val_3 = 20004567543; maybe 1,200 unknown amounts. What I need is to define a table where I can dump & accumulate data into it from user data which comes from my database and then retrieve the results from the table and print/display it in a report form.
  5. Niche, I've looked at /studied all the W3S documentation and it doesn't solve my problem. The same with your example (maybe it's a case that I don't understand). I don't have fixed data to put in the table - like Peter and age etc. My equivalent of Peter, Ben and Joe would be account names and I don't know what they are -they are the user's entries and different for different users. So, what I need is to define the table, then have code to fill the table with the user's input, and then code to extract from the table to print. If you look at my posting again you will have a better idea of what I mean - I have done an edit giving more info. (My original posting was incomplete and got posted by accident). I hope you can help me - I've been working on this all day - wasted time unfortunately. Thanks
  6. I need to set up the following table (or ARRAY) but don't know how to define it. Acct A month 1 month 2 month 3 …. month 12 Acct B and so on (unknown quantity ) I tried various solutions but no success. My latest code is: //Deffinition: $AcctNum=array ( $MyMonths=array() ); Filling: $MyMonths[$row[5]][$effmo] = $MyMonths[$row[5]][$effmo] - $row[3]; Extracting: print("$AcctNum[1] $MyMonths[1] $MyMonths[2] ....... $MyMonths[12]<br> $AcctNum[2] $MyMonths[1] $MyMonths[2] ....... $MyMonths[12]<br> etc. ");
  7. The third section of code below gave me some results (some amounts) but these were incomplete so I coded the first (TEMP) section to list my rows for debugging purposes. When I did that, the results in my third section all changed to 0 amounts. So, for further debugging purposes, I coded section 2. Section 1 listed my rows but section 2 did not list any rows - only the "LIST2" & "END2". I don't understand why, I get 0 amounts nor why section 2 wont list. (I don't think I have coding errors). //TEMP SECTION 1 -------------------------- print("List1<br>"); $rowcnt=$AffectedRows; $myResults=$Results; while ($rowa = mysql_fetch_row($myResults)) {print("$rowa[0] / $rowa[1] / $rowa[2] / $rowa[3] / $rowa[4] / $rowa[5] / $rowa[6] / $rowa[7] / $rowa[8]<br>");} print("END1<BR>"); //TEMP=========================== //TEMP SECTION 2 -------------------------- print("LIST2<br>"); $rowcntx=$AffectedRows; $myResults=$Results; while ($rowx = mysql_fetch_row($myResults)) {print("$rowx[0] / $rowx[1] / $rowx[2] / $rowx[3] / $rowx[4] / $rowx[5] / $rowx[6] / $rowx[7] / $rowx[8]<br>");} print("END2<BR>"); //TEMP=========================== SECTION 3---------- for ($loop=1;$loop<($AffectedRows+1);$loop++) {while ($row = mysql_fetch_row($Results)) {if($row[8]=="b") {$BBal[$row[4]] = ($BBal[$row[4]] - $row[3]); $BBal[$row[5]] = ($BBal[$row[5]] + $row[3]);} else{$Bal[$row[4]] = ($Bal[$row[4]] - $row[3]); $Bal[$row[5]] = ($Bal[$row[5]] + $row[3]);}}} ...print results...
  8. Upon loading, the code works. My form area get highlighted with yellow. In the second case, Java goes through the code but my area does not get highlighted. I also tried calling myload function but that also didn't work - maybe not doing it the right way. <style type='text/css'> .start-here {background-color: yellow;} </style> <script type='text/javascript'> //======================================= function myload() //This code does it's job of highlighting my form starting at field 'all' {var c = document.ReportsForm.all; c.focus(); c.parentNode.className = 'start-here'; c.onblur = function() {this.parentNode.className = '';} } //====================================== function formcheck(myform) {if (all.checked || .checked || liab.checked || inc.checked || exp.checked){;} else {alert('A Type of Account must be selected.'); //This alert takes place. var c = document.ReportsForm.all; // this code has no results c.focus(); // " c.parentNode.className = 'start-here'; // " c.onblur = function() // " {this.parentNode.className = '';} // " alert('TEST IF REACHED'); //This alert takes place. return false } } //=============================================== function formcheck(myform) {if (all.checked || .checked || liab.checked || inc.checked || exp.checked){;} else {alert('A Type of Account must be selected.'); //This alert takes place. window.myload() //This did not result in highlighting. return false } }
  9. byyr contains 20. If I add 1, I get 201 (wrong result). (See first set of code below) If I multiply by 5, I get 100 (correct result). (See second set of code below) If I multiply by 1, I get 100 (correct result). According to documentation, a + in Java Script is addition. I have spent over 2 hrs trying to figure out what was wrong with my (more complicated) coding. Please, please, tell me why addition doesn't work. function mytab(byyr,bymo,mo,fld,to) {with (byyr, bymo, mo, fld, to) var x = byyr.value var y = x + 1; alert(y);} function mytab(byyr,bymo,mo,fld,to) {with (byyr, bymo, mo, fld, to) var x = byyr.value; var y = x * 5; alert(y);}
  10. Is it possible to style the "alert", I.e., make the message RED and /or make the message font size 14 or the text bold?
  11. Thanks. I made the corrections and all is OK now. However, if frame="box" is obsolete, how do I get a box?
  12. I've corrected the error(s) and put everything as Table attributes and so I get the correct results except for the width - it doesn't work. I just can't understand why not and can't see anything wrong with my attribute spec. I use the same thing in other pages and it works fine. <table cellpadding='10' cellspacing='0' frame='box' width='40%' border='1px'; border-color='Blue' background-color='lavendure' align='center'> P.S. All the best to you in 2020!
  13. I'm using the following according to dsonesuk advice and it works fine.. To pass the parameter: function ancester(myparam) {if(myparam==''){return false;} location.href='FT_Search2.php?param='+myparam;return false; window.open(location.href); return false;} To get the parameter: {$reqref=$_GET['param'];} Thanks for the help!
  14. I'm not getting a frame and I'm not getting a width of 40% but a very large width wider than my screen. Why? <table style='cellpadding:10; cellspacing:0; align:center; width:40%; frame:box; border:1; bordercolor:Blue'; background-color:lavendure' > Same thing with <table cellpadding:10; cellspacing:0; align:center; width:40%; frame:box; border:1; bordercolor:Blue; background-color:lavendure >
  15. It's not a case of "just thinking". There is a decision making via the "if" statement so I don't see why there shouldn't be a facility to go to a new page based on the decision. One should be able to do "anything" without human intervention. However, it seems that is not possible with website programming - something I consider a deficiency. Nonetheless, thanks for your help!
  16. How do I open a new page (replacing the current one) in inline code, i.e. without the need to click something? e.g., if(x=y) open new page else{continue....
  17. I just can't understand what's going on. At the bottom of this post is my results - which doesn't follow at all the CSS and I have no idea where the blue bordered incorrect sized box comes from. I did the Inspect Element thing but can't see any answers in there. Would much appreciate your help. Here is a sample code of my page followed by the code of my HA_StyleA.css file. <?php session_start(); print(" <html lang=\"en\"> <head><title>Index</title></head> <link rel=\"stylesheet\" href=\"HA_StyleA.css\" type=\"text/css\" /> <script language=JavaScript> </script><noscript>Your browser does not support JavaScript!</noscript><body> "); //========================================================================================================== print(" <form name=\"Company\" action=\"HA_LogInCheck.php\" method=\"POST\" onsubmit=\"return formcheck(Company)\"> <br><br><br><center> <p class='onea'> <br> <font size=3 Color=\"Crimson\"><b> This is my test data.<br> The quick brown fox jumped over the lazy dog's back.<font Color=\"blue\"> Mary had a little lamb and was the doctor upset!<br> </b><font color=\"black\"> The quick brown fox jumped over the lazy dog's back. <br><br> </p> </body></html>"); ?> //Following is my HA_StyleA.css file code: .onea {max-width: 80%; border-style: solid; border-width: 2px; border-color: transparent; padding-left: 5px; padding-right: 5px; text-align: left}
  18. I have date 2019-02-01 and I need to subtract x days from it. I believe I first need to convert my date to timestamp, subtract my x days, and convert back to my date format. If that's correct, how do I convert to timestamp? (Just can't find it in documentation.) Tks
  19. It takes 18/20 seconds to execute this code when I click my Submit Button- much much too long. Why? Also, why does it not pass focus to my "Submit" button upon completion? function formcheck(myform) {with (myform) if (yy.value.length!=2){alert('Year must be 2 digits.');yy.select();return false;} if (mm.value.length!=2){alert('Month must be 2 digits.');mm.select();return false;} if (dd.value.length!=2){alert('Day must be 2 digits.');dd.select();return false;} if (dd.value<'01' || dd.value>'31'){alert('Invalid Day.');dd.select();return false;} if (mm.value<'01' || mm.value>'12'){alert('Invalid Month.');mm.select();return false;} if (yy.value<'01' || yy.value>'99'){alert('Invalid Year.');yy.select();return false;} if (((mm.value == '04' || mm.value == '06' || mm.value == '09' || mm.value == '11') && dd.value > '30') || mm.value == '02' && dd.value > '29'){alert('Invalid Day for Month or visa versa.');dd.select();return false;} alert{'Finished');return false;}}}}}} <-------- Temporary in order to time the process. else{sub.focus;return true;}}}}}} <-------- Normal code to pass focus to "Submit" button BUT doesn't work! <form name=\"DateSetting\" action=\"HA_DateSet.php\" method=\"post\" onsubmit=\"return formcheck(DateSetting)\"> YY <input style='text-align:center;width:30' name='yy' id='yy' required MaxLength=2 onkeyup='mytab(yy,mm)'> &#160;MM <input style='text-align:center;width:30' name='mm' id='mm' required MaxLength=2 onkeyup='mytab(mm,dd)'> &#160;DD <input style='text-align:center;width:30' name='dd' id='dd' required MaxLength=2 onkeyup='mytab(dd,sub)'>
  20. The link you gave me is not at all clear. It only gives an example instead of explaining/teaching. However, I came up with the following and it works: <style> @media print {.noprint {display: none !important;}} </style> <input type=\"button\" value='Print' class='noprint' onclick='myprint()'> function myprint() {window.print();} Thanks for your help.
  21. How do we prevent Buttons from printing when printing a page? I thought it should something like putting class='noprint' in the button code but that doesn't work. Tks
  22. mickeymouse

    Baffling CSS

    I have a link for a css file but I don't have a css file. Yet my has <p class='five'> (see code below) I'm baffled as to where does my browser get the box, with borders and background color as follows: Also, if I include the css file with the p.five defined with a smaller box, the result is still the same as above. (see my css file attached - perhaps I haven't defined it correctly.) ... <link rel='stylesheet' href='HA_StyleA.css' type='text/css' /> ... print(" <form name='Reg' > <br><br><br><br><font size=4 color='maroon'><b><center> <p class='five'> Select the desired function<br> from the above menu items. <br></font> </b></p> HA_StyleA - Copy.css
  23. Can I have an input tag with no borders?
  24. OK. I found the problem. One of my field parameters for selection did not contain the correct info and the Affected Rows = 0 was indeed correct. It is now working (and Affected Rows is giving me the correct count). Regrets for taking up your time. Thank you.
×
×
  • Create New...