Jump to content

stockton

Members
  • Posts

    319
  • Joined

  • Last visited

    Never

Posts posted by stockton

  1. The missing rows are the last ones and as print_r also has them missing I suspect that those rows are not returned by the mssql_fetch_array().

    As the missing rows are also missing in the print_r I do not feel that we have an HTML error.

    The browser "show source" also has those rows missing.

    The complete loop follows.

        $SQL = "Select * from Event WHERE ParentID=".$EventID." ORDER BY EventID";
    // echo $SQL;
        $rs = mssql_query($SQL, $link);
        if ($rs == FALSE)
            {
            $Message = sprintf("%s %d <br>Query failed!", __FILE__, __LINE__);
            trigger_error($Message, E_USER_ERROR, $link);
            exit;
            }
    
        echo "<TABLE BORDER=3 width=99% height=15 cellpadding=1 align=center>";
        echo "<tr bgcolor=deeppink><th>ID<th>EventName</th><th>MessageName</th><th>StartDate</th><th>EndDate</th><th>LastDrawDate</th><th>ManualTicketIssue</th><th>EarnRate</th><th>Dependants</th><th>Areas</th><th>Threshold</th><th>FreeTickets</th></th></tr>\n";
        $Count = 0;
        while ($row = mssql_fetch_array($rs))
            {
    echo "<pre>";
    print_r($row);
    echo "</pre>";
            $intID = $row['EventID'];
            $txtEventName  = $row['EventName'];
    
            $SQL = "Select MessageID, MessageName, Message, UserID from Message where MessageID = ".$row['MessageID'];
            $result = mssql_query($SQL, $link);
            $wor = mssql_fetch_array($result);
    
            $intMessageID = $wor['MessageName'];
            $intParentID = $row['ParentID'];
            $StartDate  = $row['StartDate'];
            $EndDate  = $row['EndDate'];
            $LastDrawDate  = $row['LastDrawDate'];
            $StartDate = dateconvert($StartDate,2);
            $EndDate = dateconvert($EndDate,2);
            $LastDrawDate = dateconvert($LastDrawDate,2);
            $ManualTicketIssue = $row['ManualTicketIssue'];
            if ($ManualTicketIssue == 0) $ManualTicketIssue = "Yes";
               else $ManualTicketIssue = "No";
            $intAreas = $row['SubtractBack'];
    // echo "AreasID = ".$intAreas;
    //
    // Now get applicable Areas Name
    // 
            if ($intAreas == 0) $AreasName = "All Areas";
            else
                {    
                $SQL = "SELECT * FROM Areas where AreasID = $intAreas"; // was EarnRateName;
                $rs = mssql_query($SQL, $link);
                while ($rws = mssql_fetch_array($rs))
                    {
                    $AreaID = $rws['AreasID'];
                    $AreasName = sprintf("%s", $rws['AreasName']);
                    }
                }
            $intThreshold = $row['Threshold'];
            if ($intThreshold == "") $intThreshold = 0;
            $FreeTickets = $row['RegTick'];
            if ($FreeTickets == "") $FreeTickets = 0;
            $EarnRate = $row['EarnRate'];
            $UserID = $row['UserID'];
    //        $SQLER = "SELECT COUNT(*) FROM EarnRate WHERE EarnRateID = $intID";
    //        $rser = mssql_query($SQLER, $link);
            $Numrecs = 0;
            $SQLDP = "SELECT COUNT(*) FROM Event WHERE ParentID = ".$intID;
            $rsdp = mssql_query($SQLDP, $link);
            $wordp = mssql_fetch_array($rsdp);
            $Numrecs = $wordp[0];
    
    // echo $Datum;
            $Kleur = '"#000000"';
            if (($Count % 2) != 0) $Kleur = '"#0000FF"';
            echo "<tr bgcolor=$Kleur onMouseover=this.bgColor='gray' onMouseout=this.bgColor=$Kleur>
            <td align=\"center\"><a href=\"eventsUD.php?UID=$intID\"><font color=yellow>$intID</font></td>
            <td align=\"center\">$txtEventName</td>
            <td align=\"center\">$intMessageID</td>
            <td align=\"center\">$StartDate</td>
            <td align=\"center\">$EndDate</td>
            <td align=\"center\">$LastDrawDate</td>
            <td align=\"center\">$ManualTicketIssue</td>
            <td align=\"center\">$EarnRate</td>
            <td align=\"center\"><a href=\"events.php?EventID=$intID\"><font color=yellow>$Numrecs</font></td>
            <td align=\"center\">$AreasName</td>
            <td align=\"center\">$intThreshold</td>
            <td align=\"center\">$FreeTickets</td>
            </tr>\n";
            ++$Count;
    //         if ($Count > 15) break;
            }
    
    

  2. If I run

    Select * from Event WHERE ParentID=32 ORDER BY EventID
    

    in Enterprise manager I get correct results of 7 rows but if I run

    Select * from Event WHERE ParentID=" . $EventID." ORDER BY EventID
    

    in my php proggie I only get 5 rows as is proved by doing a print_r of the result.

        $EventID=32;
        $SQL = "Select * from Event WHERE ParentID=" . $EventID." ORDER BY EventID";
        $rs = mssql_query($SQL, $link);
        if ($rs == FALSE)
            {
            $Message = sprintf("%s %d <br>Query failed!", __FILE__, __LINE__);
            trigger_error($Message, E_USER_ERROR, $link);
            exit;
            }
    
        $Count = 0;
        while ($row = mssql_fetch_array($rs))
            {
    print_r($row);
    

    and the print_r shows

    Array ( [0] => 175 [EventID] => 175 [1] => Test1 [EventName] => Test1 [2] => 0 [MessageID] => 0 [3] => 32 [ParentID] => 32 [4] => 2009-01-05 00:00:00 [startDate] => 2009-01-05 00:00:00 [5] => 2009-07-02 23:59:59 [EndDate] => 2009-07-02 23:59:59 [6] => 2009-12-07 23:59:59 [LastDrawDate] => 2009-12-07 23:59:59 [7] => 1 [ManualTicketIssue] => 1 [8] => 0 [subtractBack] => 0 [9] => 1 [Threshold] => 1 [10] => 15 [userID] => 15 [11] => 0 [RegTick] => 0 [12] => SLT_1500 [EarnRate] => SLT_1500 ) 
    Array ( [0] => 205 [EventID] => 205 [1] => Test 2 [EventName] => Test 2 [2] => 14 [MessageID] => 14 [3] => 32 [ParentID] => 32 [4] => 2009-02-03 00:00:00 [startDate] => 2009-02-03 00:00:00 [5] => 2009-05-03 23:59:59 [EndDate] => 2009-05-03 23:59:59 [6] => 2009-12-03 23:59:59 [LastDrawDate] => 2009-12-03 23:59:59 [7] => 1 [ManualTicketIssue] => 1 [8] => 0 [subtractBack] => 0 [9] => 4 [Threshold] => 4 [10] => 15 [userID] => 15 [11] => 0 [RegTick] => 0 [12] => SLT_500 [EarnRate] => SLT_500 ) 
    Array ( [0] => 207 [EventID] => 207 [1] => Test3 [EventName] => Test3 [2] => 14 [MessageID] => 14 [3] => 32 [ParentID] => 32 [4] => 2009-01-03 00:00:00 [startDate] => 2009-01-03 00:00:00 [5] => 2009-07-01 23:59:59 [EndDate] => 2009-07-01 23:59:59 [6] => 2009-12-03 23:59:59 [LastDrawDate] => 2009-12-03 23:59:59 [7] => 1 [ManualTicketIssue] => 1 [8] => 0 [subtractBack] => 0 [9] => 1 [Threshold] => 1 [10] => 15 [userID] => 15 [11] => 0 [RegTick] => 0 [12] => SLT_2000 [EarnRate] => SLT_2000 ) 
    Array ( [0] => 210 [EventID] => 210 [1] => ECD Test [EventName] => ECD Test [2] => 0 [MessageID] => 0 [3] => 32 [ParentID] => 32 [4] => 2009-04-17 00:00:00 [startDate] => 2009-04-17 00:00:00 [5] => 2009-07-17 23:59:59 [EndDate] => 2009-07-17 23:59:59 [6] => 2009-08-23 23:59:59 [LastDrawDate] => 2009-08-23 23:59:59 [7] => 1 [ManualTicketIssue] => 1 [8] => 0 [subtractBack] => 0 [9] => 1 [Threshold] => 1 [10] => 15 [userID] => 15 [11] => 0 [RegTick] => 0 [12] => SLT_500 [EarnRate] => SLT_500 ) 
    Array ( [0] => 211 [EventID] => 211 [1] => ECD Test 2 [EventName] => ECD Test 2 [2] => 15 [MessageID] => 15 [3] => 32 [ParentID] => 32 [4] => 2009-04-23 00:00:00 [startDate] => 2009-04-23 00:00:00 [5] => 2010-12-25 23:59:59 [EndDate] => 2010-12-25 23:59:59 [6] => 2010-12-30 23:59:59 [LastDrawDate] => 2010-12-30 23:59:59 [7] => 1 [ManualTicketIssue] => 1 [8] => 2 [subtractBack] => 2 [9] => 1 [Threshold] => 1 [10] => 15 [userID] => 15 [11] => 0 [RegTick] => 0 [12] => SLT_2000 [EarnRate] => SLT_2000 ) 
    

    not enough rows????

    BTW I added the line breaks to make reading easier.

    Suggestions please

  3. Please explain the relevance of the $this-> in the following snippet that I need to maintain.

    <?php
    $this->loadClass('htmlheading', 'htmlelements');
    $this->loadClass('fieldset', 'htmlelements');
    $this->loadClass('textinput', 'htmlelements');
    $this->loadClass('hiddeninput', 'htmlelements');
    $this->loadClass('label', 'htmlelements');
    $this->loadClass('checkbox', 'htmlelements');
    $this->loadClass('button', 'htmlelements');
    $title = $this->objLanguage->languageText('mod_flights_addflight', 'flights');
    // .........snip......... to save bandwidth the rest of the code has been cut out. 
    

  4. I get no results if I run the following program, but if I cut and paste the echoed SQL into Apex SQL Commands I do get the results that I am after.

    Please tell me what I have done wrong?

    <?php
    global $conn;
    
    /*
    * Main body starts here
    *
    */
        echo "Test for 20101207 <br />";
    
        $conn=oci_connect("s7s", "big", "localhost");
        if ( ! $conn )
            {
            $e = oci_error();  // For oci_connect errors pass no handle
            echo "Unable to OCILogon to database. ".$e["message"];
            die();
            }
        else
            {
            echo "Connected<br />";
            }
    
        $Event = "203";
        $MemberNum = "2020230335"; // "2020000669";
        $StartDate = "2010-04-01 00:00:00";
        $EndDate   = "2010-10-28 23:59:59";
        $TablesArray = array(1, 3);
        $TablesCount = 2;
    
        $Datum = date("Y-m-d H:i:s");    /* 2006-03-17 23:22:32 */
        $TableTickets = $SlotsTickets = $TableTurnover = $SlotsTurnover = $BonusTickets = $TicketsAlreadyIssued = 0;
        $TableTickets = $SlotsTickets = $TableTurnover = $SlotsTurnover = 0;
    
        $SQL  = "SELECT trans_code,trans_table_name,SUM(TRANS_TURNOVER) TablesTurnover ";
        $SQL .= "FROM TRANSACT ";
        $SQL .= "join tables on trans_table_name = tbl_code ";
        $SQL .= "where TRANS_CODE = '".$MemberNum."' AND ";
        $SQL .= "TRANS_DATE BETWEEN TO_DATE('".$StartDate."','YYYY/MM/DD HH24:MI:SS') AND ";
        $SQL .= "TO_DATE('$EndDate','YYYY/MM/DD HH24:MI:SS')";
        $i = 0;
        if ($TablesCount > 0)
            {
            $SQL .= " AND (";
            }
        else
            {
            $SQL .= ";";
            }
        while ($i < $TablesCount)
            {
            $SQL .= "tbl_pit = '";
            $SQL .= $TablesArray[$i];
            $i++;
            if ($i < $TablesCount) $SQL .= "' or ";
            else $SQL .= "') Group by trans_code, trans_table_name;";
            }
    
        echo "Tables<br />".$SQL."<br />";
    
        $stmt = oci_parse($conn, $SQL);
        oci_execute($stmt);
        while ($row = oci_fetch_row($stmt))
               echo htmlentities($row)." ";
    ?>
    

     

    Result from program/script is:-

    Test for 20101207
    Connected
    Tables
    SELECT trans_code,trans_table_name,SUM(TRANS_TURNOVER) TablesTurnover FROM TRANSACT join tables on trans_table_name = tbl_code where TRANS_CODE = '2020230335' AND TRANS_DATE BETWEEN TO_DATE('2010-04-01 00:00:00','YYYY/MM/DD HH24:MI:SS') AND TO_DATE('2010-10-28 23:59:59','YYYY/MM/DD HH24:MI:SS') AND (tbl_pit = '1' or tbl_pit = '3') Group by trans_code, trans_table_name;
    

     

    result from Apex is:-

    2020230335	PB02	25093333.33
    2020230335	AR25	6708333.34
    2020230335	AR18	0
    2020230335	PB08	21054167.21
    2020230335	AR20	0
    2020230335	AR16	0
    2020230335	AR19	0
    2020230335	AR15	1590458.33
    2020230335	BJ20	0
    2020230335	PB07	2672066.67
    

     

     

  5. I installed php-5.3.2-Win32-VC6-x86.msi and now Apache will not start.

    No error messages that I can find and I have looked in both access.log and error.log.

    Where else could I look for the problem.

    BTW If I comment out the alterations made by the php install to my httpd.conf namely as follows

     

    #BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

    #PHPIniDir "C:/Program Files/PHP/"

    #LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"

    #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

     

    then Apache works again.

  6. Is there a method one could use in either HTML, CSS or Javascript to resize an alert box?

    If this is not possible could one create one's own window that looks like an alert/confirm box but is resizeable?

    I also need this window to be always on top, no matter what applications the user is running. Can this also be done?

    BTW I only need a text message appearing in said box. Very like an alert or confirm, but I want it to be big and always on top.

  7. I have the following html

    <html>
    <head>
    <title>Voucher Usage</title>
    <script language="JavaScript" type="text/javascript" src="js/Diva.js"></script>
    </head>
    <body onLoad="document.VU.Number.focus()">
    <form name="VU" id="VU" method="post" >
    Voucher Number: <input type="text" size="20" maxlength="20" id="Number" name="Number" onChange='submit_click(this.value)'><br />
    <center>
    <div id="loadingNode"></div>
    </center>
    </body>
    </html>
    <script language=javascript>
    function submit_click(VoucherNumber)
        {
        if ((VoucherNumber[0] == ";") && (VoucherNumber[strlen(VoucherNumber) -1] == "?"))
            {
            VoucherNumber.substr(1,(strlen(VoucherNumber) - 2));
            }
        progExe(VoucherNumber);
        }
    </script>
    

     

    and the javascript looks like:-

     

    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 xhr = getXMLHttpRequest();
    //        setTimeout(progExe(),500);
    
    function progExe(CommandString)
            {
            var xhr = getXMLHttpRequest();
            alert("CommandString = " + CommandString);
            var url="voucher.php";
            url=url+"?Number="+CommandString;
    
            xhr.open("GET", url, true);
            xhr.onreadystatechange = ServerResponse;
            xhr.send(null);
            }
    
    function ServerResponse()
            {
    //        alert("entered ServerResponse()");
    /* The full list of the readyState values is as follows:
        * 0 (uninitialized)
        * 1 (loading)
        * 2 (loaded)
        * 3 (interactive)
        * 4 (complete)
    */
            if(xhr.readyState == 0)
                {
                document.getElementById("loadingNode").innerHTML = "Uninitialized........";
                }
            else
            if(xhr.readyState == 1)
                {
                document.getElementById("loadingNode").innerHTML = "Loading........";
                }
            else
            if(xhr.readyState == 2)
                {
                document.getElementById("loadingNode").innerHTML = "Loaded........";
                }
            else
            if(xhr.readyState == 3)
                {
                document.getElementById("loadingNode").innerHTML = "Interactive........";
                }
            else
            if(xhr.readyState == 4)
                {
                if (xhr.status == 200)
                    {
                    alert(xhr.responseText);
                    }
                else
                    {
                    alert(xhr.status + " Text= " + xhr.responseText + " XML= " + xhr.responseXML);
                    }
                }
            }
    
    

     

    the php on the server looks like:-

     

    <?php
    require_once('includes/configuration.php');     // database connect script & the rest.
    
    $Message = "";
    if (empty($_GET['Number']))
        {
        $Message = "Invalid voucher number!";
        }
        else
        {
        DBConnect();        // Connect to Events database
        $VoucherNum = $_GET['Number'];
        $SQL = 'SELECT * FROM Voucher WHERE Number='.$VoucherNum;
        $rs = mssql_query($SQL, $link);
        $Count = 0;
        while ($row = mssql_fetch_array($rs))
            {
            $EventName = $row['Number'];
            $Datum     = $row['DatePresented'];
            $Message   = $EventName." already processed on ".$Datum;
            ++$Count;
            }
        if ($Count == 0)
            {
            $Datum = date("Y-m-d H:i:s");    /* 2006-03-17 23:22:32 */
            $SQL = sprintf("INSERT INTO Voucher(Number, DatePresented) VALUES ('%s','%s')",$VoucherNum, $Datum);
            $rs = mssql_query($SQL, $link);
            $Message   = $EventName." successfully registered on ".$Datum;
            }
        DBDisConnect();     // Disconnect from Events database
        }
    echo $Message;
    
    ?>
    
    

     

    Please tell me what I have done wrong as I am not getting the $Message appearing in the alert() where I expect it to appear.

    The user is to scan in the voucher number and the system is to verify if the voucher has previously been scanned or not.

  8. The following now works but I don't understand what changed to make it work.

    <?php
    $operator = fgets(STDIN);
    $operator = $operator[0];
    echo var_dump ($operator) . "<br/>\n";
    echo ord(trim($operator[0]));
    // echo "\n".$operator."\n";
    switch ($operator) {
    case '+':
       echo "\nPlus\n";
       break;
    case '-':
       echo "\nMinus\n";
       break;
    }
    ?>
    
    

    the result of the above is:-

    php Switch.php
    +
    string(1) "+"
    <br/>
    43
    Plus
    

     

  9. Please tell me what stupid mistake I have made in the following code.

    <?php
    $operator = fgets(STDIN);
    $operator = $operator[0];
    echo "\n".$operator."\n";
    switch ($operator) {
    case '+':
       echo "Plus";
       break;
    case '-':
       echo "Minus";
       break;
    }
    ?>
    
    

     

    The switch never finds a case for either operator. Why?

×
×
  • 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.