Jump to content

Butterbean

Members
  • Posts

    70
  • Joined

  • Last visited

Everything posted by Butterbean

  1. I see that now. Thank you for your help. I wonder why its returning an error in php 5 whereas it did not in earlier versions. Does Php55 accept this operand?
  2. if ($query === false){ exit("<pre>".print_r(sqlsrv_errors(), true));}while ($row = sqlsrv_fetch_array($query)){ $sumUsageKWH += $row['totalUsage'];}sqlsrv_free_stmt($query);?> This is how its being used. I will read your link. Thank you.
  3. I have looked everywhere trying to find out what += means. I am getting an error , Fatal error: Unsupported operand types in C:\xampp1\htdocs\Utrack\invoice.php on line 73". I just realized after upgrading from mssql 2008r2 to mssql 2014, this error started. Can someone please help me a bit? Thanks.
  4. Got it! Messed my AND up. That resolved the issue.. Thanks a million!
  5. we are getting the start date and meter id from the db to authenticate the customer, then we are subsequently posting data back to the server.
  6. thought this would work but did not. $sql = "UPDATE [radiogates].[dbo].[ops_invoice_history] SET payment_date = '$payment_date', amount_paid = '$amount_paid', check_number = '$check_number' where start_date = '$start_date'& meter_id = '$meter_id' ";
  7. This is posting to any row in mssql that has a matching 'start_date'. I would like it to post rows where start_date = '$start_date' and it also matches the 'meter_id' . It should perform this check of both parameters before posting to mssql. <?php $session_id = $_SESSION['id']; $comm_id = $_GET['meter_id']; $start_date = $_GET['start_date']; $payment_date = $_POST['payment_date']; $amount_paid = $_POST['amount_paid']; $check_number = $_POST['check_number']; $sql = "UPDATE [radiogates].[dbo].[ops_invoice_history] SET payment_date = '$payment_date', amount_paid = '$amount_paid', check_number = '$check_number' where start_date = '$start_date'"; $query = sqlsrv_query($conn, $sql); Thank you for any help.
  8. If I knew at the time how to fix the account, I wouldn't be in here getting reprimanded by someone that obviously doesn't know the answer to the question and wouldn't provide an answer if he did!!! So, if you have nothing better to say, move along and mind your business please. Thank you. Check yourself at the door!
  9. When I set up MS SQL on my machine, for whatever reason I did not set up a UID or password. I can not get the php to connect with SQL because I do not have a UID and password on the db (which I know is not smart). I don't understand code enough to know how to manipulate this string below to remove the requirement. Ultimately, the other approach would be to go back and add a Username and Password to the MS SQL Db but that seems to be a feat also. Any help getting past this small hurdle would be appreciated. It is set up as a db engine. $serverName = "BASEMENT\SQLEXPRESS"; //serverName\instanceName $connectionInfo = array( "Database"=>"aaaaaaa", "UID"=>"bb", "PWD"=>"cccccccc"); $conn = sqlsrv_connect( $serverName, $connectionInfo); Thank you in advance.
  10. Normally like you say, I should be able to add "New Database", but there is no where to add it as it is just a blank white rectangular box of nothing. I will try it again. Thank you.
  11. Basically, there is nothing in my objects explorer hierarchy to the left.
  12. For reasons unknown to me I installed this version of MSSQL 2008 R2 yesterday and it came with an attached database for which I was able to add my own database to. I had to uninstall and reinstall this version because I was having some permissions conflicts....now when I reinstalled the 2008 R2, there is no database attached. There is no preinstalled db engine. I do not know how to create this or drop my db into the object explorer because there is no db attached. I hope this makes sense. What I am trying to do is set up a test server on my home computer. I saved the actual db from a work computer onto a thumbdrive. Now, I want to attach it to my home server. That option is not there to connect now. Thank you for any help.
  13. I should be clearer. I can start apache but can not get the htdocs to display my php content. Also, I can not find a 64 bit version. Does that even matter?
  14. Port 80 in use by "Unable to open process" with PID 4! Apache WILL NOT start without the configured ports free! You need to uninstall/disable/reconfigure the blocking application or reconfigure Apache and the Control Panel to listen on a different port This is the error I get, but I am able to stat Apache after i receive the error. Separately, I noticed this version of XAMPP is for 32 bit.. My system is 64 bit. Guess maybe that is the problem. Any suggestions?
  15. I had an issue initially where I had to adjust my windows uac settings. Also, does it matter that I have a dynamic ip even though I'm working on a local host?
  16. I went into xampp control....configuration. ..then went into the appache configuration file and editEd all places where it read 80 to read 81.
  17. I am working from my home computer using windows 8.1. I downloaded Xampp, installed notepad++ and created a simple echo statement using PHP. I then placed the statment into the htdocs file. Then I went to my browser and entered the path as localhost:81/invoice.php (I used 81 because 80 is used for another application). I also changed all of the locations where it defaulted to 80 (using the find function, so I know I covered them all). I still recieved this message below. I know they are seeing each other for two reasons.. 1. I get another error message when I make up a fake file path in localhost folder. 2. The error is a 404. Also, I can see Xampp dashboard at localhost:81/xampp. I am stumped. Could it be my security settings or the fact that I am on a home server? Also, could it be problem with having mysql and microsoft sql server 2008 R2 on the same machine? Any help would be awesome. Also, yes my Xampp is started up (Apache and Mysql). Thanks. Object not found! The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again. If you think this is a server error, please contact the webmaster. Error 404 localhost Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3
  18. I have created a system that uses an API to drop utility data into MSQL Server 2008. Once the data is in the db, a web app can query the data to create electric bills. Currently we are working with only one customer but are entertaining expansion and want to approach the growth from the best possible angle. Considering that all data is the same type of data but comes from different customers and sources, would it be best to maintain 1 database with all of the utility meter data streaming to it or would it be best to have a new data base with each customer? Also, assuming we keep it all in the same database, would it be best (assuming we are secure) to have all the individual customers data go to the same tables or have separate tables for separate customers. I'm pretty certain I know the answer but I'm a novice so that means nothing. Thank you for any help with this issue.
  19. See above post, i cleared it up. Thank you for your help. I'm sorry for my confusion.
  20. "Um, what? How is the difference between Jan 8 and Jan 11 represented as 3-4=1??? The difference will be three (either negative or positive)." ..................................................................................................................................................................................................................... A query would never have to cycle through more than 1 time, so its not needed to cycle through twice as is below,( 2nd column of numbers after the dates) jan 1 2014.......1......1 jan 2 2014.......2......2 jan 3 2014.......3......3 jan 4 2014.......4......4 jan 5 2014.......1......5 jan 6 2014.......2......6 jan 7 2014.......3......7 jan 8 2014.......4......8 jan 9 2014.......1......9 jan10 2014......2......10 jan11 2014......3......11 Simply put, where ever the query starts, it would need to convert (so to speak) through only one (1) cycle. In an actual example from my code posted in a previous response above, it takes several months for a customers kWh to reach the ongoing number of 99,999,999 (which is the recycle point). As a result, there will never be a query that goes through two cycles of numbers (like above). I was just attempting to say you only need to cycle one time. Basically whenever the query starts, if it starts at 99,999,945 and ends at 10, it needs to obtain the values from the query and code it appropriately so that it understands, 10 represents 100,000,010 for the sake of performing the calculation of 100,000,010 - 99,999,945 = 65 kwh (kilowatt hours). Otherwise, the value displayed is 10 - 99,999,945 = -99999935 which is incorrect by the apps standards. Thanks for helping.
  21. I understand what you are saying. I provided a little more to go on. As i mentioned, Im looking for basic direction only. I'm thrown into this code and have to come up with a solution in 30 days. Problem is I have enough knowledge to troubleshoot and that's about it. I'm going to learn what I can and make it happen, just looking for a nudge. See post above.
  22. <?php $sql = ";WITH TOTAL_KWH_SUMMER AS ( SELECT CONVERT(VARCHAR(10),cdate,111)AS trans_date, datepart(hh, cdate) as trans_hour, comm_id, MIN((total_energy_a+total_energy_b+total_energy_c)/100) AS minUsage, MAX((total_energy_a+total_energy_b+total_energy_c)/100) as maxUsage, repeated FROM [radiogates].[dbo].[purge_data] where comm_id='$comm_id' group by comm_id, CONVERT(VARCHAR(10),cdate,111), datepart(hh, cdate), repeated ) SELECT *, datepart(weekday, trans_date) as trans_date_day, datepart(month, trans_date) as trans_date_month, maxUsage - minUsage as totalUsage FROM TOTAL_KWH_SUMMER where datepart(weekday, trans_date) IN ('1', '2', '3', '4', '5', '6', '7') AND DATEPART(MONTH, trans_date) IN ('5','6','7','8','9','10') and trans_date BETWEEN '$startdate2 00:00:01' AND '$enddate2 24:00:00' and repeated <> '1' "; $query = sqlsrv_query($conn, $sql);if ($query === false){ exit("<pre>".print_r(sqlsrv_errors(), true));}while ($row = sqlsrv_fetch_array($query)){ $sumUsageKWH += $row[totalUsage];}sqlsrv_free_stmt($query);?> To answer your question, yes, the timestamps are in the table. I have it filtering by above, down to the 15 minutes. We are using sql server 2012. The table housing the data is [purge_data] listed above. Im just not sure where to go. Not asking for someone to do this work, just a direction to get me started. Maybe even a small intro tutorial of sorts.
  23. Suppose I have a series of numbers being stored in an SQL table, which are not uniform and constantly growing. Once the numbers in the table (in sql) hit 99,999,999, they start back at 1, and do it all over again continuously until the end of time. If I am performing calculations in PHP on these numbers (stop date-start date), is there a function that can take a look at the next cell after 99,999,999 and acknowledge that the 1 is really 100,000,000. In the below example, instead of using 99,999,999, we used 4 as the last number before numerical reset. Once the numbers hit 4, they reset to 1. continuously. Example1. If I were to subtract Jan 1(start) from jan 4(stop) I would have Stopdate -Startdate = 4-1 =3. Example2. If I were to subtract Jan 4(start) from jan 7(stop) I would have Stopdate-Startdate = 3-4 =-1 but should be 7-4 for the sake of the calculation only. Example3. If I were to subtract Jan 8(start) from jan 11(stop), I would have Stopdate-Startdate = 3-4=-1 but should be 11-8=3 but for ease of not having to be a continuous repeating thing, can be represented at 7-4. There is no need to keep a running memory towards infinity. It just needs to know that any number after some number ending in 4 is 5, instead of reseting to 1. jan 1 2014.......1 jan 2 2014.......2 jan 3 2014.......3 jan 4 2014.......4 jan 5 2014.......1 jan 6 2014.......2 jan 7 2014.......3 jan 8 2014.......4 jan 9 2014.......1 jan10 2014......2 jan11 2014......3 Hope this is not that confusing. Long story short, I can't do a stopdate-startdate = somenumber, if that some number keeps resetting to 1 once it reached 99,999,999. As a result, my code will work perfectly until I reach 99,999,999, then I am in trouble because 1-99,999,999 is not equal to 1, where 100,000,000 -99,999,999 = 1 thanks.
×
×
  • 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.