Jump to content

rusking

Members
  • Posts

    52
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

rusking's Achievements

Member

Member (2/5)

0

Reputation

  1. <label id="TABLE" value="DEBITS" selected="selected" </label> Im trying to just declare the ID "TABLE" as "DEBITS" it was a drop down adn now i need it staic for when i call it later. It is in a form. So ill be calling it $_POST[TABLE]. Im just a little uncertain how to achive this as this value is declared from another page too so i can change how i call it just how this page (one above) declairs it. Anyone got any pointers?
  2. i think that solved it, thankyou very much
  3. It currently adds the amounts column if i use SUM. Im wanting it to when it narow the date, only add the amounts ('vaule') shown. The third returned image shows its still addin all teh amounts instead of teh selected dates. The first returned image shows every entry for reference
  4. fixed the outputs so they should be easier to read now
  5. SELECT TYPE,date , (Amount) FROM DEBITS where TYPE='Cell Phone' HAVING Date BETWEEN '1999-05-20 00:00:00' AND '2013-05-21 00:00:00' Gives me : Im trying to add all the 'Vaule' displayed. IF i SUM like this SELECT TYPE,date , SUM(Amount) FROM DEBITS where TYPE='Cell Phone' HAVING Date BETWEEN '1999-05-20 00:00:00' AND '2013-05-21 00:00:00' I get: This seems correct but if i chage the dates and sum: SELECT TYPE,date , SUM(Amount) FROM DEBITS where TYPE='Cell Phone' HAVING Date BETWEEN '2012-05-20 00:00:00' AND '2013-05-21 00:00:00' I return : I am new to MySQLi and have been learning it the past 30 hours. Ultimately if i could add only the 'Vaule' of the proucted array i should be ok but i keep breaking it
  6. $Totals is the actual SQL script being ran
  7. yea i know but iv kinda had to learn 3 languages at one time and its kinda big as it is <?php //Site Directories $rootsite='http://localhost:8888'; $ownersdebits='http://localhost:8888/owners/debits/'; //Connection Oriented $con=mysqli_connect("localhost","root","root","BOYLEdanville"); //$con=mysqli_connect("BOYLEdanville.db.10675146.hostedresource.com","BOYLEdanville","JAMESbond007!!","BOYLEdanville"); $sumline="SELECT SUM(AMOUNT) AS value_sum FROM DEBITS"; //$TEST='AMOUNT'; //$sumline="SELECT SUM($TEST) AS value_sum FROM DEBITS"; //refer to http://www.tutorialspoint.com/mysql/mysql-sum-function.htm for above //$Totals="SELECT TYPE, SUM() FROM DEBITS GROUP BY AMOUNT //$Totals="SELECT '$_POST[TYPE]', SUM($_POST[COLUMN]) AS 'value_sum' FROM $_POST[TABLE] GROUP BY '$_POST[TYPE]'"; //working for all:| if ($_POST[action] == ''){$Groupby='';} Else{$Groupby='GROUP BY TYPE';} If ($_POST[element_1_3] > ''){$bydates="HAVING Date BETWEEN '$_POST[element_1_3]-$_POST[element_1_1]-$_POST[element_1_2] 00:00:00' AND '$_POST[element_2_3]-$_POST[element_2_1]-$_POST[element_2_2] 00:00:00'";} Else{$bydates='';} //$Groupby="HAVING Date BETWEEN '$_POST[element_1_3]-$_POST[element_1_1]-$_POST[element_1_2] 00:00:00' AND '$_POST[element_2_3]-$_POST[element_2_1]-$_POST[element_2_2] 00:00:00'" $addedup="SELECT TYPE,date , SUM($_POST[COLUMN]) FROM $_POST[TABLE] WHERE TYPE='$_POST[CATEGORY]'"; $Totals="SELECT TYPE,date , $_POST[action]($_POST[COLUMN]) FROM $_POST[TABLE] WHERE TYPE='$_POST[CATEGORY]' $Groupby $bydates"; // /SELECT TYPE,date , Amount FROM DEBITS WHERE TYPE = 'Cell Phone' having Date BETWEEN '2013-05-19 09:14:48' AND '2013-05-19 12:39:22'; // THE ABOVE WORKED!!!!!!!!!!!! ?> lots of testing has been done in the past 24 hours as my A.D.D wont let me sleep and iv been learning PHP,MYSQLi and html
  8. OOo the 4 hours of cirlces iv travled on this one. echo "<table border='1'> <tr> <th>Category</th> <th>Value</th> <th>Date</th> <th>AddedUp</th> </tr>"; $result = $con->query($Totals); while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row[0] . "</td>"; echo "<td>" . $row[2] . "</td>"; echo "<td>" . $row[1] . "</td>"; echo "<td>" . array_sum($row[2]) . "</td>"; echo "</tr>"; } echo "</table>"; Iv been tring to get it to add all the vaules in row [2]. Below is the table but i can get teh "Values" added up. I was wanting the total of "Value" to be at the bottom of the table but every combination i try to add or sum it up wont work. Yes i tried array_sum, might nt have used it correctly but did try. IF anyones got an idea please chime in
  9. I am trying $thesum = $result['value_sum']->fetch_field(); or $thesum = $result->fetch_field(); right before echo $thesum; $result->close; this the right direction?
  10. Ok i see, i eblive the command im looking for to fetch is ->fetch_field(); if im incorrect please let me know. I do find it slighly difficult to find where to place it...im trying to learn from this url http://www.php.net/manual/en/mysqli-result.fetch-field.php
  11. I seem to have most of this complete as I get results from the database in the table but can add some values together. The error I recieve is "Select returned 1 rows." I am trying to get a return of a column added (the column contains numbers) Any guidance is appreciated, I'm switching to PHP as my main language but still new to it (coming from AUTOIT) I'm using MAMP to locally server (MYSQL,Apache etx) is use this to build my sites then host them live. The SQL server has a structure as such: localhost » KNTDEBITS » Insurance <?php $con=mysqli_connect("localhost","root","root","KNTDebits"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result4 = mysqli_query($con,"SELECT * FROM DanvilleLocation"); //Table 4 Start echo "<table border='5'> <tr> <th>Danville</th> <th>Date</th> <th>Payment</th> <th>Payer</th> </tr>"; while($row4 = mysqli_fetch_array($result4)) { echo "<tr>"; echo "<td>" . $row4[''] . "</td>"; echo "<td>" . $row4['DATE'] . "</td>"; echo "<td>" . $row4['PAYMENT'] . "</td>"; echo "<td>" . $sum . "</td>"; echo "</tr>"; } echo "</table>"; //Table 5 Start echo "<table border='5'> <tr> <th>Total</th> </tr>"; if ($result = $con->query("SELECT SUM(STATECOV) AS value_sum FROM Insurance")) { printf("Select returned %d rows.\n", $result->num_rows); /* free result set */ echo $result; $result->close(); } echo "</table>"; echo $result; mysqli_close($con); ?>
  12. <?php $tempFolder = 'C:\\xampp\\htdocs\\remote\\'; // location of temporary folder (must be writable by webserver), DON'T include trailing slash $filename7Z = 'C:\\xampp\\7-zip\\7z.exe'; // 7zip executable filename '7za' or '7zr' $sessionKey = 'iworked'; $commandtest = "'C:\\xampp\\7-zip\\7z.exe a " .$tempFolder. "c" .$sessionKey. ".7z C:\\xampp\\htdocs\\remote\\client\\' copy /b C:\\xampp\\htdocs\\remote\\support\\7zS.sfx+ C:\\xmapp\\htdocs\\remote\\client\\config.txt+".$tempFolder."c".$sessionKey.".7z c".$sessionKey.".exe'"; $output = exec($commandtest); echo "<pre>$output</pre>"; ?> No file and a blank page. Don't see any output results. Any ideas...i must be missing something very basic
  13. Opps my bad, you pointed to a diff site...will read
  14. I have and am still not sure how, as in my last statement i get mixed or useless results. Not sure which $results or >2 etc to use
  15. so in winvnc.exe' copy /b is the php sending return (enter) after the winvnc.exe and then sending copy /b etc...? Because i cant really see whats happening and i don't see a result. I think i may have tried this but scratched it because it produced nothing. I assume if this is in fact correct there is a minor problem with the execution. I cant be sure without seeing it. One time i tried the exec($comamndtest , $output) , reading this from the tutorial or help i never say were $output was defined. i think i used a >2 something another aswell and still not much luck. I keep trying to find a logging process till after i did the code looked soo messy i was confused what i was doing again. I guess what im asking is what is the cleanest most efficient way to log the out put so i see where the failure is in the suggestion you gave me. Not saying your wrong, i just may have not stated something earlier.
×
×
  • 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.