Jump to content

stockton

Members
  • Posts

    319
  • Joined

  • Last visited

    Never

Everything posted by stockton

  1. In my HTML page that calls Ajax I have a field defined as:- <td width=195 style="position:absolute; visibility: hidden;" id="CNumber" name="CNumber"></td> and in Ajax I attempt to retrieve its contents by :- var KaartNommer = document.getElementById("CNumber").innerHTML; and I have also tried:- var KaartNommer = document.getElementById("CNumber").value; both fail and doing an alert() I get told that it is undefined. Please tell me how I got this wrong as other field values on the same webpage defined & retrieved in the same manner work fine.
  2. I need to write a PHP script that will update two tables in the same database which MUST be kept in step. I thought that transaction logic would apply but how does one confirm that an insert into a table was successful. I have looked at mssql_query() but am not 100% sure that checking the result from that call is satisfactory.
  3. Can someone please explain to me why the following code works perfectly in Firefox but fails in Internet Explorer? function getXMLHttpRequest () { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {}; try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {}; try { return new XMLHttpRequest(); } catch(e) {}; return null; } // Make the XMLHttpRequest object var http = getXMLHttpRequest(); function sendRequest(Mode, Event, CardNumber) { // Call PHP script for requests /* For debug purposes */ document.getElementById("loadingNode").value = "Calling TI3SGM-3.php"; http.open('get', 'TI3SGM-3.php?EventID='+Event+'&MemberNum='+CardNumber); http.onreadystatechange = handleClientDataResponse; } function handleClientDataResponse() { // document.getElementById("loadingNode").value = "Ons wag vir 'n wenner"; if(http.readyState == 4 && http.status == 200) { // Text returned from the PHP script var response = http.responseText; if(response) { // UPDATE ajaxResponse content var parts = response.split("|"); var MemberName = document.getElementById("MemberName"); if (!MemberName) { alert("We have a problem!"); } // alert(response); document.getElementById("CNumber").innerHTML = parts[0]; document.getElementById("MemberName").innerHTML = parts[1]; var SlotsValue=parseInt(parts[2],10); if (isNaN(SlotsValue)) SlotsValue=0; document.getElementById("SlotsValue").innerHTML = SlotsValue; var SlotsTurnover=parseInt(parts[3],10); if (isNaN(SlotsTurnover)) SlotsTurnover = 0; document.getElementById("SlotsTurnover").innerHTML = SlotsTurnover; var SlotsIssued=parseInt(parts[4],10); if (isNaN(SlotsIssued)) SlotsIssued = 0; document.getElementById("SlotsIssued").innerHTML = SlotsIssued; var TablesValue=parseInt(parts[5],10); if (isNaN(TablesValue)) TablesValue = 0; document.getElementById("TablesValue").innerHTML = TablesValue; var TablesTurnover=parseInt(parts[6],10); if (isNaN(TablesTurnover)) TablesTurnover = 0; document.getElementById("TablesTurnover").innerHTML = TablesTurnover; var TablesIssued=parseInt(parts[7],10); if (isNaN(TablesIssued)) TablesIssued = 0; document.getElementById("TablesIssued").innerHTML = TablesIssued; document.getElementById("Earned").innerHTML = SlotsValue+TablesValue; var BonusValue=parseInt(parts[8],10); if (isNaN(BonusValue)) BonusValue = 0; document.getElementById("BonusValue").innerHTML = BonusValue; var BonusIssued=parseInt(parts[9],10); if (isNaN(BonusIssued)) BonusIssued = 0; document.getElementById("BonusIssued").innerHTML = BonusIssued; document.getElementById("Total").innerHTML=SlotsValue+TablesValue+BonusValue; var IssuedValue=parseInt(parts[10],10); if (isNaN(IssuedValue)) IssuedValue = 0; IssuedValue = SlotsIssued+TablesIssued+BonusIssued; document.getElementById("IssuedValue").innerHTML = IssuedValue; var TotalValue=SlotsValue+TablesValue+BonusValue; var OutstandingValue=TotalValue-IssuedValue; document.getElementById("OutstandingValue").innerHTML = OutstandingValue; var MayIssue=parseInt(parts[11],10); if ((OutstandingValue > 0) && (MayIssue == 1)) { document.getElementById("Issue").disabled=false; document.getElementById("Issue").src = 'images/issue.png'; } document.getElementById("loadingNode").value = ""; // document.getElementById("ajaxResponse").value = response; // confirm(parts[0]); } } else if (http.readyState < 4) { // document.getElementById("loadingNode").value = "Loading........"; ShowAjaxStatus(http.readyState); } function ShowAjaxStatus(What) { document.getElementById("loadingNode").value = "Ons wag"; if(What == 0) { document.getElementById("loadingNode").value = "Uninitialized........"; } else if(What == 1) { document.getElementById("loadingNode").value = "Loading........"; } else if(What == 2) { document.getElementById("loadingNode").value = "Loaded........"; } else if(What == 3) { document.getElementById("loadingNode").value = "Interactive........"; } }
  4. Thanks but I have still to understand code tags?
  5. Please tell me what I have done wrong in the following code. $SQL = "SELECT EventID, EventName, LastDrawDate FROM Event WHERE '$Datum'>=StartDate AND '$Datum'<=LastDrawDate"; $rs = mssql_query($SQL, $link); echo '<td><select name="Event">'; while ($row = mssql_fetch_array($rs)) { $Number = $row['EventID']; $Message = sprintf("%25.25s", $row['EventName']); $LastDrawDate = $row['LastDrawDate']; echo "<option value=".$Number.">$Message</option>"; ++$Count; } echo '</select></td>'; echo "<a href=TI3-2.php?Event=$Number><img src=images/Submit.png></a>"; The table works perfectly but the $Number in the last line retains the same value no matter what was selected in the table.
  6. I have a working web application (intranet) that currently successfully displays a web page with necessary data and subsiquently, using JavaScript, prints a slightly reformatted version of the page. My user has now asked me to perform another action between the above mentioned action which effectively means the web page gets overwritten. Is there a way for me to save this web page complete with the data displayed thereon and after performing the required action redisplay the original page?
  7. One can in Linux prefix a script as follows:- #!/usr/bin/php -q and then run the script from the command line & the -q tells PHP to leave all HTML out. How can this be done in Microsoft Windows.
  8. cj in the PHP forum on the Oracle site <http://forums.oracle.com/forums/thread.jspa?messageID=2003652&#2003652> recommended var_dump($stmt) after the parse. var_dump($stmt) returns:- resource(18) of type (oci8 statement) which, as a nooby to Oracle, I really do not understand. but his suggestion of removing the semi-colon at the end of the command line has certainly given me a different result with which I can now go forward with. Thank you cj.
  9. Thank you, that is what I thought.
  10. I have a system made up of many PHP scripts each of which when started does a ociLogon() and when complete an ociLogoff() and my question is would it not be better to ociLogon() as the system is started and only when the user is finished with the system ociLogoff()?
  11. When I run the following from my php application/script I find that I get no data back but when I run just the SQL statement in Database Express' SQL Command console (Apex) I get good data back. $StartDate="2006/01/01 06:00:00"; $EndDate="2007/09/29 6:00:00"; $SQL = "SELECT TRANS_TABLE_NAME, SUM(TRANS_TURNOVER) TotalTurnover FROM TRANSACT where (TRANS_CODE = '$number' AND (TRANS_DATE BETWEEN TO_DATE('$StartDate','YYYY/MM/DD HH24:MI:SS') AND TO_DATE('$EndDate','YYYY/MM/DD HH24:MI:SS'))) GROUP BY TRANS_TABLE_NAME;"; $stmt = OCIParse($conn, $SQL ); OCIExecute($stmt); // echo $SQL; $Count = 0; while (OCIFetch($stmt)) { echo "COL1=" . ociresult($stmt, "COL1") . ", COL2=" . ociresult($stmt, "COL2") . "\n"; $Count++; } if ($Count == 0) { print "\nError code = " . ora_errorcode(); print "\nError message = " . ora_error(); $Message = sprintf("No play by [%s] found! ", $number); trigger_error($Message, E_USER_ERROR); die(); } Please tell me what I have got wrong.
  12. I am calling a stored procedure from my php program and get the following error/warning:- Warning: ocibindbyname() [function.ocibindbyname]: OCIBindByName: ORA-01036: illegal variable name/number in C:\Program Files\Apache Group\Apache2\htdocs\Events\OracleGetClientTest.php on line 111 Warning: ocibindbyname() [function.ocibindbyname]: OCIBindByName: ORA-01036: illegal variable name/number in C:\Program Files\Apache Group\Apache2\htdocs\Events\OracleGetClientTest.php on line 112 My code looks like:- $StartDate="2006/01/01 06:00:00"; $EndDate="2007/07/26 17:00:00"; $SQL = "begin spPackage.spTablesPlayed(_number, _recordset); end;"; $stmt = OCIParse($conn, $SQL ); $curs = OCINewCursor($conn); if (!$stmt) { trigger_error(sprintf("spTablesPLayed Cannot parse query for [%s] ", $number), E_USER_ERROR); die(); } OCIBindByName($stmt,"_number",&$number,15); OCIBindByName($stmt,"_startdate",&$StartDate, 20); <-------- line 111 OCIBindByName($stmt,"_enddate",&$EndDate, 20); <-------- line 112 OCIBindByName($stmt,"_recordset",&$curs,10,OCI_B_CURSOR); and the relevant piece of the stored procedure look like:- PROCEDURE spTablesPlayed( p_number cards.card_number%type, --varchar2 p_startdate varchar2, p_enddate varchar2, cv_tablesplayed out tablesplayed_cur_type); Please tell me what I am misunderstanding.
  13. If my program defines $Vandag as $Vandag = date('d/m/Y H:i:s'); and I compare that with what I retrieved from MSSQL I get:- Vandag = 11/07/2007 17:15:23 Start = 26/06/2008 11:31:25 End = 26/07/2009 11:31:25 UVandag = 1194448523 UStart = 1265448685 UEnd = 1297071085 Start & End are ex MSSQL and if I alter to $Vandag = date('d-m-Y H:i:s'); // Note hyphen instead of slash the echo in my program reports:- Vandag = 11-07-2007 17:23:59 Start = 20/06/2007 13:39:12 End = 30/12/2009 23:59:59 UVandag = 1482852239 UStart = 1218022752 UEnd = 1307915999 As you can see in neither case is Vandag less than Start but strtotime() seems to think that it is. This is on a Windows XP machine and I am obviously missing something but what? I also fail to understand why there should be a difference between hyphen seperated dates as against slash seperated. BTW the date format is, I believe, dd/mm/ccyy
  14. That was about where I had got to except that I was going to call the server side PHP directly and it could echo the error message(with a tag to show this is an error) and if no error carry on normally.
  15. Javascript is not an issue as this system is intranet and the users have been told by their managment to use IE only and anyway I check that Javascript is enabled at logon time.
  16. I have created a system using PHP & Javascript that works OK except that I want a neat display of error messages. Error messages caught at the client are displayed in a Javascript alert, which is fine. But errors caught at the server are not as well displayed and therefore I thought that I would ask if anyone has produced a "popup error message page" that would look similar to a Javascript alert but would originate at the server.
  17. Thank you for your suggestions and offer of help but the problem was that I was not defining a var. Now why Firefox accepts this and IE does not beats me. I altered IssuedValue = parseInt(MyIssuedValue,10); to var IssuedValue = parseInt(MyIssuedValue,10); & now it works.
  18. Sorry but I have tried all of your suggestions all without success.
  19. Please tell me why IE6 is having an issue with the following Javascript var MyIssuedValue = document.getElementById("IssuedValue"); var MyOutstandingValue = document.getElementById("OutstandingValue"); IssuedValue = parseInt(MyIssuedValue,10); alert("IssuedValue = "+IssuedValue); IE tells me Problem with this Web page Line: 154 Char: 17 Error: Object does not support this property or method Code: 0 Now there is no line 154 in the html page so I am looking at the attached/called Javascript and line 154 is the alert("IssuedValue = "+IssuedValue); line???????? ???
  20. I solved it by document.getElementById("Issue").disabled=false; document.getElementById("Issue").src = 'images/issue.png'; when I want the issue button/image displayed and document.getElementById("Issue").disabled=true; document.getElementById("Issue").src = 'images/IssueNot.png'; when I want the Do Not Issue(or rather cannot issue) image displayed.
  21. I have successfully used the random number technique and recommend it.
  22. I am sure that I have seen a small script that on condition 1 will display one button and on another condition will cause another button to display but despite googling I have not found same. Suggestions please ???
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.