Jump to content

stockton

Members
  • Posts

    319
  • Joined

  • Last visited

    Never

About stockton

  • Birthday 05/13/1939

Profile Information

  • Gender
    Male
  • Location
    Midrand South Africa

stockton's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. That silly/sloppy $rs problem was the problem & as soon as I altered it to $rsArea all was well. Thank you again. Now how do I mark this as resolved?
  2. 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; }
  3. 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
  4. Thank you. I suspect that the same thing could be achieved by using globals(which is not a great idea)?
  5. 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.
  6. even if I:- while ($row = oci_fetch_all ($stmt)) { $GameType = $row[0]; $Turnover = $row[1]; } I get nothing returned from the database.][/code]
  7. From my original message I would have thought that it was obvious that I am getting all the echos displayed but no data from the database. I apologise if I was not clear enough.
  8. 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
  9. Now I have installed php-5.2.13-Win32-VC6-x86.msi and it works but has no MSSQL support.
  10. The version I installed was php-5.3.2-Win32-VC6-x86.msi and I cannot find any error messages and if I comment out the PHP addition to my Apache configuration file Apache works fine.
  11. Is there something similar one could use in MSSQL to achieve the same purpose?
  12. 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.
  13. So if I install VC6 x86 Thread Safe (2010-Mar-04 20:11:08) I should be OK?
  14. Thank you, no wonder I could not find it.
×
×
  • 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.