Jump to content

rusking

Members
  • Posts

    52
  • Joined

  • Last visited

Everything posted by rusking

  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.
  16. hmm im not sure i follow it very well. Let me try.. So would $commandtest and $commandtest2 combined look like $commandtest= "'C:\\xampp\\7-zip\\7z.exe a ' .$tempFolder. 'c' .$sessionKey. '.7z C:\\xampp\\htdocs\\remote\\client\\ helpdesk.txt icon1.ico icon2.ico icon3.ico winvnc.exe' copy /b C:\\xampp\\htdocs\\remote\\support\\7zS.sfx+ C:\\xmapp\\htdocs\\remote\\client\\config.txt+'.$tempFolder.'c'.$sessionKey.'.7z c'.$sessionKey.'.exe'"; all the escapes are \\ to indicate that they are backslashes. Or are you saying to drop the ' and replace with " becuase of the below statement? That makes me think if im using single, that two backslashes will be printed. Wow im even lost in the help lol
  17. I have 3 variables that im still cleaning up but they produce results at least. I have spent a couple days searching how to execute (exec or shell_exec) them in order. The best iv found, this is done like $statementa = 'cd test"' then do this"' exec=($statementa) but what i am doing is a bit more complicated $tempFolder = 'C:\\xampp\\htdocs\\remote\\'; $filename7Z = 'C:\\xampp\\7-zip\\7z.exe'; $sessionKey = '12345' $commandtest1= 'C:\\xampp\\7-zip\\7z.exe a ' .$tempFolder. 'c' .$sessionKey. '.7z C:\\xampp\\htdocs\\remote\\client\\ helpdesk.txt icon1.ico icon2.ico icon3.ico winvnc.exe'; //semi working, copies entire dir $commandtest2 = 'copy /b C:\\xampp\\htdocs\\remote\\support\\7zS.sfx+ C:\\xmapp\\htdocs\\remote\\client\\config.txt+'.$tempFolder.'c'.$sessionKey.'.7z c'.$sessionKey.'.exe'; //create executable in build directory \\\\not working\\\\\\ $commandtest3 = 'del /F /Q '.$tempFolder.'\\c'.$sessionKey.'.7z'; //remove *.7z from %tmp% directory \\\\\\\\\working\\\\\\\ //session_write_close(); exec($commandtest1); Where i cant seem to find any guidance is, if i wrap these in " then is looks fine in dreamweaver but produces nothing. I think it may be the variables but i cant be sure. I tried todo $exec($commandtest1 & $commandtest2) but that didn't help any then i tired ($commandtest1 | $commandtest2) still noting. It seems i can just have three exec so i have to comine into one however i have several breaks where it need todo the first then sencond then third. Please someone point me in the correct direction. I must have read http://php.net/manual/en/function.exec.php at least 6 times and either miss is each time or haven't been able to apply it to my code correctly
  18. note: above these line it states $ret = ''; but later down (after the lines) it states shell_exec($ret);
  19. Ok i have figured this out....the php itself is refrencing dos command incorrectly. I did this in dos Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Xampp>cd\ C:\>cd C:\xampp\htdocs\remote\ C:\xampp\htdocs\remote>cd client && ..\win '..\win' is not recognized as an internal or external command, operable program or batch file. C:\xampp\htdocs\remote\client>cd client &&\win The system cannot find the path specified. C:\xampp\htdocs\remote\client>cd client && The syntax of the command is incorrect. C:\xampp\htdocs\remote\client>cd client The system cannot find the path specified. C:\xampp\htdocs\remote\client>cd.. C:\xampp\htdocs\remote>cd client && The syntax of the command is incorrect. C:\xampp\htdocs\remote>cd client && .. '..' is not recognized as an internal or external command, operable program or batch file. C:\xampp\htdocs\remote\client>cd \win The system cannot find the path specified. C:\xampp\htdocs\remote\client>cd win C:\xampp\htdocs\remote\client\win>dir Volume in drive C has no label. Volume Serial Number is 2CAB-D2CB Directory of C:\xampp\htdocs\remote\client\win 09/20/2011 08:31 PM <DIR> . 09/20/2011 08:31 PM <DIR> .. 09/20/2011 08:26 PM 543 helpdesk.txt 11/24/2009 11:50 AM 6,518 icon1.ico 11/24/2009 11:50 AM 2,550 icon2.ico 11/24/2009 11:50 AM 6,518 icon3.ico 11/24/2009 11:50 AM 245,760 winvnc.exe 5 File(s) 261,889 bytes 2 Dir(s) 72,537,120,768 bytes free C:\xampp\htdocs\remote\client\win>C:\xampp\7zip\7z.exe a C:\xampp\htdocs\remote\ inc\tmp c1234.7z helpdesk.txt icon1.ico icon2.ico icon3.ico winvnc.exe 7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 Scanning c1234.7z: WARNING: The system cannot find the file specified. Creating archive C:\xampp\htdocs\remote\inc\tmp.7z Compressing icon1.ico Compressing icon2.ico Compressing icon3.ico Compressing helpdesk.txt Compressing winvnc.exe WARNINGS for files: c1234.7z : The system cannot find the file specified. ---------------- WARNING: Cannot find 1 file C:\xampp\htdocs\remote\client\win>C:\xampp\7zip\7z.exe a C:\xampp\htdocs\remote\ inc\tmp\ c1234.7z helpdesk.txt icon1.ico icon2.ico icon3.ico winvnc.exe 7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 Scanning c1234.7z: WARNING: The system cannot find the file specified. Creating archive C:\xampp\htdocs\remote\inc\tmp\.7z Compressing icon1.ico Compressing icon2.ico Compressing icon3.ico Compressing helpdesk.txt Compressing winvnc.exe WARNINGS for files: c1234.7z : The system cannot find the file specified. ---------------- WARNING: Cannot find 1 file C:\xampp\htdocs\remote\client\win>C:\xampp\7zip\7z.exe a C:\xampp\htdocs\remote\ inc\tmp\c1234.7z helpdesk.txt icon1.ico icon2.ico icon3.ico winvnc.exe 7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 Scanning Creating archive C:\xampp\htdocs\remote\inc\tmp\c1234.7z Compressing icon1.ico Compressing icon2.ico Compressing icon3.ico Compressing helpdesk.txt Compressing winvnc.exe Everything is Ok C:\xampp\htdocs\remote\client\win>C:\xampp\7zip\7z.exe a C:\xampp\htdocs\remote\ inc\tmp\c1234.7z helpdesk.txt icon1.ico icon2.ico icon3.ico winvnc.exe 7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 Scanning Creating archive C:\xampp\htdocs\remote\inc\tmp\c1234.7z Compressing icon1.ico Compressing icon2.ico Compressing icon3.ico Compressing helpdesk.txt Compressing winvnc.exe Everything is Ok C:\xampp\htdocs\remote\client\win>cd\ C:\>cd . C:\>cd C:\xampp\htdocs\remote\ C:\xampp\htdocs\remote>cd .. C:\xampp\htdocs>cd C:\xampp\htdocs\remote\ C:\xampp\htdocs\remote>cd built C:\xampp\htdocs\remote\built>copy /b \support\7zS.sfx+ \client\config.txt+ C:\xa mpp\htdocs\remote\inc\tmp\c1234.7z c1234.exe The system cannot find the path specified. C:\xampp\htdocs\remote\built>copy /b C:\xampp\htdocs\remote\support\7zS.sfx+ C;\ xampp\htdocs\remote\client\config.txt+ C:\xampp\htdocs\remote\inc\tmp\c1234.7z c 1234.exe The syntax of the command is incorrect. C:\xampp\htdocs\remote\built>copy /b C:\xampp\htdocs\remote\support\7zS.sfx+ C:\ xampp\htdocs\remote\client\config.txt+ C:\xampp\htdocs\remote\inc\tmp\c1234.7z c 1234.exe C:\xampp\htdocs\remote\support\7zS.sfx C:\xampp\htdocs\remote\client\config.txt C:\xampp\htdocs\remote\inc\tmp\c1234.7z 1 file(s) copied. C:\xampp\htdocs\remote\built> And it made the file perfectly, the php cant achive this. So i changed the php to this $ret .= 'cd client' .$filename7Z.' a '.$tempFolder.'\c'.$sessionKey.'.7z helpdesk.txt icon1.ico icon2.ico icon3.ico winvnc.exe'; //compress vnc server and config files $ret .= 'cd built copy /b \support\7zS.sfx+ \client\config.txt+'.$tempFolder.'\c'.$sessionKey.'.7z c'.$sessionKey.'.exe'; //create executable in build directory $ret .= 'del /F /Q '.$tempFolder.'\\c'.$sessionKey.'.7z && '; //remove *.7z from %tmp% directory However the top line is getting a syntex error that i am apparently missing. I need to make it "cd client" then hit enter or ";" so i thought and then do the rest of line 1 and then 2. any ideas?
  20. As written here i am trying todo the php remote support. What i was wondering is in sections line $ret .= 'cd client && ..\\win\\'.filename7z ' a ' etc, why does the user use \\ instead of a single \ and whats with the &&? i have the original php file and it reads $ret .= shell_exec('cd client;' . $filename7Z . ' a '' etc Now i know the original was made for Xampp in windows but i can get it nor this guys version to work. I assume that the \\ and && are specific to windows file systems but i can figure out how. I am trying to modify it to work on my 2k8r2 server or win7(running xampp) but get dead ends in both places. My Ubuntu server is a whole diff animal. can anyone give me any guidance? original file location here
  21. I dont think i do, would you care to explain please
  22. oo hey i didnt kow you where in this section too I don't fully understand how to correct it. I know i want it to search for the username to see if it exist but that was the best i could come up with and am not sure how to make it "do" something. I have made the username via the html then tried the same username agin. Says welcome still and then i check the database and the username is already there.
  23. Hi all, thread go moved, can anyone help with this?
  24. Correction, my html was off where i renamed the vaules. It post now. The only catch is it it always post and always says welcome new user. I think im useing the incrorrect vaule at the if ($query =='[username]') part but not sure what the correct would be. <?php $con = mysql_connect("wserver.com","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("dbtest", $con); $query = "SELECT username, id, message FROM partylist"; if ($query =='[username]') echo "User already exist"; else { $sql="INSERT INTO partylist (RecordID, Username, ID) VALUES ('$_POST[firstname]','$_POST[username]','$_POST[id]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Welcome New User"; } mysql_close($con) ?>
  25. hmm i must be off somewhere because now it says welcome user and puts nothing in the table. Even if the user exist i still get a Welcome new user . Well it does put something in the table...blankness. Just a blank entry <?php $con = mysql_connect("yesmyserver","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("dbtest", $con); $query = "SELECT username, id, message FROM partylist"; if ($query =='username') echo "User already exist"; else { $sql="INSERT INTO partylist (RecordID, Username, ID) VALUES ('$_POST[firstname]','$_POST[username]','$_POST[id]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Welcome New User"; } mysql_close($con) ?>
×
×
  • 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.