Jump to content

w424637

Members
  • Posts

    9
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

w424637's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Help please - I have a simple page which errors with: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in If I remove the Second Query and Output section it works also If I remove the First Query and Output section it works However both together and it fails at the line while($row=mysql_fetch_array($new2)) Why is this - drivign me nuts <?php require_once ('connection.php'); //First Query and Output $result = mysql_query("CALL C01_Client_Summary_ByAccount(1, '2012-02-27', '2013-03-29');"); while($row=mysql_fetch_array($result)) { echo $row['CommisionPercentage']; } //END First Query and Output //Second Query and Output $new2 = mysql_query("CALL C01_Client_Summary_ByBetType(1, '2012-02-27', '2013-03-29');"); while($row=mysql_fetch_array($new2)) { echo $row['Turnover']; } //END Second Query and Output ?>
  2. The query is going to run anyway - the values it creates are used for a chart. I needed the minimum value to provide the chart with a Yaxis minimum. thanks Simon
  3. Should anyone chance upon this I have resolved the problem. Below is the code I have changed. $myArray = array(); while($row_result = mysql_fetch_assoc($result)) { $running_total+= $row_result['trading_profit']; $myArray[] = $running_total; } echo min($myArray);
  4. I think I'm almost there but not quite getting it. I have a query - from this I run a loop to establish a running balance - daya to day cumulative total. I then want to store this as an array. and finally extract to a variable the smallest value in the entire array. Below is the rogue code!! $strQuery = "SELECT uspgi_reporting.race_date, date_conv.month2, sum(uspgi_reporting.handle) as handle, sum(uspgi_reporting.profit) as trading_profit FROM uspgi_reporting Inner Join date_conv ON uspgi_reporting.race_date = date_conv.actual_date Where 1 = 1 group by uspgi_reporting.race_date, date_conv.month2"; $result = mysql_query($strQuery) or die(mysql_error()); $row_result = mysql_fetch_assoc($result); $myArray = array(); while($row_result = mysql_fetch_assoc($result)) { $running_total+= $row_result['trading_profit']; $myArray[] = $running_total; } $minValue = min(array($myArray)); echo $minValue; Any help really appreciated
  5. I tried to get there but the below does soemthing but not quite right: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <html> <script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script> <link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" /> <head> <script> function toggle() { if( document.getElementById("hidethis").style.display=='none' ){ document.getElementById("hidethis").style.display = ''; }else{ document.getElementById("hidethis").style.display = 'none'; } } </script> </head> <body> <form id="form1" name="form1" method="post" action=""> <span id="spryselect1"> <label>hh <select onchange="toggle();" name="hh" id="hh"> <option>A</option> <option>B</option> <option>C</option> </select> </label> <span class="selectRequiredMsg">Please select an item.</span></span> </form> <table border="1"> <tr id="hidethis"> <td>A</td> </tr> <tr id="hidethis"> <td>B</td> </tr> <tr id="hidethis"> <td>C</td> </tr> </table> <script type="text/javascript"> <!-- var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1"); //--> </script> </body> </html> </html>
  6. Hi I have a query which outputs 9 rows: A 10 A 11 A 12 B 21 B 22 B 23 C 31 C 32 C 33 I have put these in a table in the usual way using repeat region etc. I also have built a select box that has A B C. I would like to know how to use javascript to show and hide the rows of my report dependant on the choice made. ie User chooses A and only the rows with A in the first field are shown etc. Without going back and requering the server. Can this be done? Any help or pointers would be very welcome thanks Simon
  7. Hi Sorry if my explanation is confusing. I have a select box on my page and the user chooses either "All Values" or one of the integers in the select box. The values could be any number as they are pulled from a database. I then want to build a query which uses the value chosen above in the where statement. Select * Where t_gh_dash1.GRD = $colname_rs_grd. This works if the user chooses an integer but if I dont know how to write the query to work if the user chooses "All Values". Is it possible to write an IF statement withing my query string do basically exclude that where command if the user chooses "All Values"?
  8. Hi and thanks I can see how that would work - however my example list of 1 2 3 4 is not a fixed list so setting $colname_rs_grd to be 1,2,3,4 dosnt work - in reality the numbers are dynamic and maybe 11,456,223,etc and there maybe 10 of them or 1000? Not sure why I can't wile card numbers like using # or ? Any other thoughts? Simon
  9. Hi Can anyone explain how to use a wildcard in a query when I am retrieving numbers / values. I have a select that has options: All, 1 2 3 4 If user chooses All I want my query to bring back records where 1,2,3,4 are included else bring back just the number chosen I have tried % and it doesnt work. Here is my section of code: I need the 0 in the first section to be % effectively. Any help appreciated $colname_rs_grd = 0; if (isset($_POST['id_grade'])) { if ($_POST['id_grade'] == "All Grades") { $colname_rs_grd = 0; }else { $colname_rs_grd = $_POST['id_grade']; } mysql_select_db($database_dashboard, $dashboard); $query_rs_tbl1 = "SELECT t_gh_dash1.`WeekDay`, 'RaceCount' AS Category, Count(distinct t_gh_dash1.RaceID) as RaceCount FROM t_gh_dash1 WHERE t_gh_dash1.Pool Like '$colname_rs_pool' AND t_gh_dash1.GRD = '$colname_rs_grd' AND t_gh_dash1.trk Like '$colname_rs_trk' GROUP BY t_gh_dash1.`WeekDay`"; $rs_tbl1 = mysql_query($query_rs_tbl1, $dashboard) or die(mysql_error()); $row_rs_tbl1 = mysql_fetch_assoc($rs_tbl1); $totalRows_rs_tbl1 = mysql_num_rows($rs_tbl1);
×
×
  • 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.