PHP - Moved: Php Install/mssql Driver Issue
This topic has been moved to Installation in Windows.
http://www.phpfreaks.com/forums/index.php?topic=347714.0 Similar TutorialsThis topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=350565.0 Hi every one, i am trying to connect with a remote SQL server on window platform. i have hostname, username, password and database name, but when i try t connect using mssql_connect($server,$username,$password) i got this Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: Thanks This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=327102.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=330453.0 Hello everyone,
<?php $sql = ";WITH TOTAL_KWH_WINTER 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, meter_multiplier FROM [radiogates].[dbo].[purge_data] LEFT OUTER JOIN [radiogates].[dbo].[ops_invoice] on [radiogates].[dbo].[purge_data].[comm_id] = [radiogates].[dbo].[ops_invoice].[meter_id] where comm_id='$comm_id'and meter_multiplier is not null group by comm_id, CONVERT(VARCHAR(10),cdate,111), datepart(hh, cdate), meter_multiplier ) SELECT *, datepart(weekday, trans_date) as trans_date_day, datepart(month, trans_date) as trans_date_month, ((maxUsage - minUsage)*meter_multiplier) as totalUsage FROM TOTAL_KWH_WINTER where datepart(weekday, trans_date) IN ('1', '2', '3', '4', '5', '6', '7') AND DATEPART(MONTH, trans_date) IN ('10','11','12','1','2','3','4') and trans_date BETWEEN '$startdate2 00:00:01' AND '$enddate2 24:00:00' "; $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);?>**************For whatever reason, my browser will not let me put this code where it needs to go, so its up top. Sorry for the inconvenience.************* My concern are code lines 4 through 15 I have PHP code that queryies MSSQL for data called kilowatt hours (kWh), set in a combination of three columns. kWh is set into the db table once every minute and it a value that starts at zero (0) at the beginning of the meters life, then continues until it reaches 10,000,000 before resetting back to zero (0). This happens over weeks, months or years, but it does happen. The code I have listed here makes no consideration of this reset. Since we are alsways querying between a start date and a stop date, we need to know the kWh usage between that period. So, we used maxUsage - minUsage and called that the totalUsage. That works great until the data reset at 10M. At that point, max usage will be some value (ex. 1 kWh), where min usage will be some value (ex. 9,999,999 kWh). the system breaks down at that point. I need to find an algorithm that helps me take into consideration this rolling number set. Thanks for any help! Edited by Butterbean, 16 January 2015 - 09:28 AM. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=353736.0 This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=317008.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=333987.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=352526.0 This topic has been moved to Microsoft SQL - MSSQL. http://www.phpfreaks.com/forums/index.php?topic=319147.0 hi i have the script below which copies data from one table to another but will only insert new data update current data or delete old data from tempproducts to products then it will delete the tempproducts from the db however i keep getting this error: Warning: mssql_query() [function.mssql-query]: Query failed in E:\UpdateProducts.php on line 33 updateproducts.php Code: [Select] <?php include('../../otherscripts/functions.php'); $log = new Logging(); // create DB connection $host = "localhost"; $user = "user"; $pass = "pass"; $mydb = "db"; $db = mssql_connect($host,$user,$pass); //Select Database mssql_select_db($mydb); // delete all old data $sql0 = "SELECT * FROM tempproduct"; $sql1 = "INSERT INTO products SELECT * FROM tempproduct WHERE manf_part_no NOT IN (SELECT manf_part_no FROM products) AND supp_id NOT IN (SELECT supp_id FROM products)"; $sql2 = "DELETE FROM products WHERE manf_part_no NOT IN (SELECT manf_part_no FROM tempproduct) AND supp_id NOT IN (SELECT supp_id FROM tempproduct)"; $sql3 = "UPDATE p1 SET p1.avail_qty = t1.avail_qty, p1.cost_price = t1.cost_price, p1.rrp = t1.rrp, p1.date_added = t1.date_added, p1.description = t1.description FROM Products p1 INNER JOIN tempproduct t1 ON (p1.manf_part_no = t1.manf_part_no AND p1.supp_id = t1.supp_id)"; $sql4 = "TRUNCATE TABLE tempproduct"; //If tempproduct is empty done Execute Commands if it is full then execute commands $query = mssql_query($sql0) or die($log->lwrite('Failed to select for count from db')); $rowcount = mssql_num_rows($query); if($rowcount == 0){ $log->lwrite('Teh tempproduct am emptyish'); } else{ mssql_query($sql1) or die($log->lwrite('Failed to insert to db'.$sql1)); mssql_query($sql2) or die($log->lwrite('Failed to Delete from db')); mssql_query($sql3) or die($log->lwrite('Failed to Update db')); mssql_query($sql4) or die ($log->lwrite('Failed to TRUNCATE db')); } ?> if i run $sql1 command in the sql manager it runs fine and no errors occur? Hi all, this is driving me crazy - I must be doing something obviously wrong. I want to load the Microsoft PHP PDO drivers. I have checked my phpinfo and found the following:- PHP Version 5.3.8 Loaded Configuration File C:\Program Files (x86)\PHP\php.ini extension_dir C:\Program Files (x86)\PHP\ext So I put the file 'php_pdo_sqlsrv_53_ts_vc9.dll' in the extension dir. I then added the following line the correct php.ini file:- ;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; extension=php_pdo_sqlsrv_53_ts_vc9.dll But when I check php info the sqlsrv driver does not appear to be loaded, not even after a reboot. All I see is: PDO drivers mysql, odbc, sqlite Not sure what I have missed. How can I tell if PHP has tried to load the sqlsrv drivers? Thanks Kev Hello guys, I've installed the mongoDB PHP driver using "sudo pecl install mongodb" Testing shows driver is installed correctly and it appears nicely in phpinfo(): ludo@aegir:~$ php7.2 -i | grep -i mongodb mongodb MongoDB support => enabled MongoDB extension version => 1.5.3 MongoDB extension stability => stable mongodb.debug => no value => no value For connecting I've got: $db = new MongoDB\Driver\Manager("mongodb://localhost:27017"); Now I want to define a collection and insert a record, i've been using code from here https://www.php.net/manual/en/set.mongodb.php: $collection = $db->mydatabase->mytable; $result = $collection->insertOne( [ 'name' => 'test', 'item' => 'testitem' ] ); But this fails Notice: Undefined property: MongoDB\Driver\Manager::$mydatabase in /var/www.... Has anyone got a workingg example of defining and inserting into mongoDB. Seems the driver was updated fairly recently and so stuff on the internet is not always relevant. Edited May 17, 2019 by ludo1960is this a server problem its the first time ive come across it. does this mean theres a problem with the PDO driver on the Mysql server.??????? is there a way of solving this the notebook lenovo g 780 runs windows 8 and is not very stable. the WLAN connecgtion is not very stable _ despite the fact that it is very very close to the router . btw: several linux-notebooks (opensuse) which are running under the same condition do not have any problem want to load a new driver - but which one is corrcet? how to find out which driver is needed? http://www.lenovo-dr...rivers-download Networking: LAN (Ethernet) Atheros LAN Driver Windows 8 (32-bit) Windows 8 (64-bit) 3.17MB Download Networking: LAN (Ethernet) Atheros Lan Driver Windows XP 3.02MB Download Networking: LAN (Ethernet) Atheros LAN Driver Windows 7 (32-bit) Windows 7 (64-bit) 5.33MB Download Networking: Wireless LAN Intel WiMax Driver Windows XP 64MB Download Networking: Wireless LAN Wireless LAN Driver (Liteon, CyberTan) Windows 8 (32-bit) Windows 8 (64-bit) 49.4MB Download Networking: Wireless LAN Intel WLAN Driver Windows XP 203MB Download Networking: Wireless LAN Intel WiMax Driver Windows 8 (32-bit) Windows 8 (64-bit) 88.7MB Download Networking: Wireless LAN WLAN Driver (Liteon, Cybertan) Windows XP 41.8MB Download Networking: Wireless LAN Intel Wireless LAN Driver Windows 8 (32-bit) Windows 8 (64-bit) 540KB Download how to find out which driver is needed? i have been trying to install with no luck come to find otu my server does not support PDO i tried to use mysql_connect instead of new PDO. however i get some weird connection error host '00.00.0 is not allowed to connect" then "call to function exec on a non object" the lines are below. $sql = mysql_connect('mysql:dbname=' . $_POST['mysqldb'] . ';host=' . $_POST['mysqlhost'], $_POST['mysqluser'], $_POST['mysqlpass']); foreach($db_sql as $statement) { $sql->exec(str_replace('ajaxim_', $_POST['mysqlprefix'], $statement)); Please tell me how to connect php and mysql in ubuntu 14.04
Hi there, I am working on a PHP ecommerce website. I am going to install SSL on few of the pages. I need to install it on Apache web server coz thats the server our PHP website is running on. How we do go about installing SSL on PHP website. Can anybody please guide me in the right direction. All comments and feedback are always welcomed. Thank you! I keep trying to install every wordpress, or php web server software I can find, the lastest being WAMP. Nothing ever works. I feel like a complete retard here being that I can't even set up a stupid program, to be ABLE to program myself. Everything I install gives me a 404 not found error when I try to load the admin index page to a browser. I honestly have no friggn clue what is going on, I know syntax pretty decently for a lot of these languages, but as far as setting them up, I might as well just shoot myself. I know they can't make it any easier with these step by step tutorials, but it just doesn't seem to work on my comp.
Hello, am having problem with connection to mssql server and database. Am using Xampp and i think there is some problem about his configuration. All the time am getting error : missing driver php_mssql.dll in xampp/php/ext/ ....and file php_mssql.dll is there (same problem with php_pdo_mssql.dll). Also am getting this error: "Fatal error: Call to undefined function mssql_connect() " I tried everything i could find on forums, blogs, and php documentation...but always same. btw... i removed ";" in php.ini from necessary lines and i copy ntwdblib.dll in necessary folders. This is my connection code: Code: [Select] $dbHost = 'Workstation:<port>'; $dbUser = 'user'; $dbPass = 'pass'; $dbName = 'database'; $con = mssql_connect ($dbHost, $dbUser, $dbPass) or die ('MsSQL connect failed. ' . mssql_error()); mssql_select_db($dbName) or die('Cannot select database. ' . mssql_error()); I also tried with: Code: [Select] $connection = odbc_connect("Driver={SQL Server Native Client 10.0};Server=$server;Database=$database;", $user, $password);but always same.... Can anybody please provide me some working solution ? Thanks. |