Jump to content

mkswanson

Members
  • Posts

    10
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

mkswanson's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm having problems with a simple mssql_connect to a remote server. $ngLink = mssql_connect($ngServer, $ngLogin, $ngPassword); if ( !$ngLink ) { die('Connection to database failed!'); } If I point the server to a local instance of SQL 2008, the connection is successful. If I point the server to a remote instance of SQL 2008, I get a connection failed message. Both the remote and local PCs are Win2K8 with SQL 2008 standard. I have successfully connected to the remote instance using SQL management studio from my web server, so this does not appear to be a problem with the firewall or blocking based on IP. I have also successfully connected to the remote SQL instance from my dev box, through management studio and PhpStorm. I have enabled TCP/IP and named pipes in SQL configuration. I have tried capturing the last PHP error, which is a generic connection failed error, as well as the last MSSQL error, which is null since a connection isn't actually happening so MSSQL isn't generating an error. I have reviewed event viewer logs as well as other logs, and not been able to find anything that points me to the right direction. Any suggestions on where I can begin to look to troubleshoot?
  2. I'm having problems with enabling the sort functions of jqgrid. I think I've narrowed the problem down to the way MSSQL is returning the data to the SQL query. In an effort to troubleshoot, I've drastically simplified the problem. The query I'm using is below. SELECT * FROM dbo.test ORDER BY locationName When I run the query directly in MSSQL Management Studio, the top 5 ID entries are 132, 1309, 1295, 1281, 1267. When I run the corresponding code in PHP, the top 5 ID entries are 1266, 1267, 1268, 1269, 1270 - it seems to be ignoring my order by clause. Is there something I need to do to force it to honor the ORDER BY locationName? $kpiQuery = "SELECT * FROM dbo.test ORDER BY locationName"; $result = mssql_query($kpiQuery); while($kpiRow = mssql_fetch_array($kpiResult)) { echo $kpiRow[plDataID]."<br>"; }
  3. Thanks for the start here. I've been trying to use get_file_contents to read in the file, but it seems to be dropping any of the characters I'm trying to use to parse this. Is this because I should be using a different command? Sorry if this is a dumb question - I don't have a lot of experience working with files since most of my work like this has been directly with a database and not an intermediate flat file. Thanks for the assistance!
  4. I have a file that is uploaded by the user that has a series of rows of data in an html table. The columns are always a constant, but the number of rows in the file can change. These rows of the html table are the only information in the file when I am processing it. I need to either convert the file to a CSV file or write the values to a CSV list so that I can then insert them into a database. Any suggestions would be wonderful...I've spent the last three hours spinning my wheels. Here is an example of one row of data from the file: <tr><td bgcolor=#dddddd class=dataFT >5 (Excellent)</td><td bgcolor=#dddddd class=dataFT >5 (Excellent)</td><td bgcolor=#dddddd class=dataFT >5 (Excellent)</td><td bgcolor=#dddddd class=dataFT > </td><td bgcolor=#dddddd class=dataFT > </td><td bgcolor=#dddddd class=dataFT >DATA</td><td bgcolor=#dddddd class=dataFT >1015020</td><td bgcolor=#dddddd class=dataFT >155498322</td><td bgcolor=#dddddd class=dataFT >DATA</td><td bgcolor=#dddddd class=dataFT >4731751</td><td bgcolor=#dddddd class=dataFT >2011-09-25 11:18:33 (-5:00)</td><td bgcolor=#dddddd class=dataFT >2011-09-25 12:16:50 (-5:00)</td><td bgcolor=#dddddd class=dataFT >0:58:17</td><td bgcolor=#dddddd class=dataFT >0:58:16</td><td bgcolor=#dddddd class=dataFT >DATA</td><td bgcolor=#dddddd class=dataFT >DATA</td><td bgcolor=#dddddd class=dataFT >DATA</td><td bgcolor=#dddddd class=dataFT >Resolved</td></tr>
  5. I knew it was something easy, but couldn't get it quite right. Thanks!
  6. I have the following information that is being returned by an LDAP query: [code]Array ( [count] => 1 [0] => Array ( [givenname] => Array ( [count] => 1 [0] => John ) [0] => givenname [objectsid] => Array ( [count] => 1 [0] => åÒÔz…ÿ&KIó¸ ) [1] => objectsid [count] => 2 [dn] => CN=John Doe,OU=ABC Users,DC=abcinc,DC=local ) ) [/code] I need to programatically extract "John" from the first line of this, and can't seem to get it. Can anyone point me in the right direction? Thanks!
  7. I just changed from an XAMPP installation to WAMPP. My PHP scripts were working perfectly, but now they aren't. I get a number of undefined constant errors: Notice: Use of undefined constant EntityID - assumed 'EntityID' in C:\WebServer\www\PollingCenter\SearchResults.php on line 145 Notice: Use of undefined constant CustomerName - assumed 'CustomerName' in C:\WebServer\www\PollingCenter\SearchResults.php on line 145 An example that is throwing the error is: $EntityID = @$_GET['EntityID'] ; $CustomerName = str_replace("'", "", (@$_GET['CustomerName'])) ; $ProductLine = @$_GET['ProductLine'] ; $ProductVersion = @$_GET['ProductVersion'] ; $Format=@$_GET['Format']; $SQLQuery=@$_GET['SQLQuery']; $TodayDate=date("Y-m-d"); $SearchEntityID = trim($EntityID); $SearchCustomerName = trim($CustomerName); $SearchProductLine = trim($ProductLine); $SearchProductVersion = trim($ProductVersion); $query = "SELECT ed.EntityID, ed.CustomerName, ed.IsActive, pd.ProductLine, pd.ProductVersion "; $query .= "FROM ENTITY_DATA ed INNER JOIN "; $query .= "(SELECT ProductLine, ProductVersion, EntityID, PollingID FROM POLLING_DATA) pd "; $query .= "ON ed.EntityID = pd.EntityID "; $query .= "WHERE pd.PollingID = (SELECT max(pollingID) FROM POLLING_DATA WHERE EntityID = ed.EntityID) "; $query .= "AND ed.IsActive = '1' "; IF ($SearchEntityID != "" ) { $query .= "AND pd.EntityID LIKE '%".$SearchEntityID."%' "; } IF ($SearchCustomerName != "" ) { $query .= "AND ed.CustomerName LIKE '%".$SearchCustomerName."%' "; } IF ($SearchProductLine != "" ) { $query .= "AND pd.ProductLine LIKE '%".$SearchProductLine."%' "; } IF ($SearchProductVersion != "" ) { $query .= "AND pd.ProductVersion LIKE '%".$SearchProductVersion."%' "; } //display the results while($row = mysql_fetch_array($result)) { echo '<tr>'; echo '<td><a href="SiteDetails.php?SiteID=' . $row[EntityID] . '">'. $row[CustomerName] . '</a></td>'; echo '<td>' . $row[ProductLine] . '</td>'; echo '<td>' . $row[ProductVersion] . '</td>'; echo '</tr>'; } Is there a global setting in PHP that might be affecting this? I have tried multiple versions of PHP (5.3.0, 5.2.11, and 5.2.9-2) with no effect. Thanks for any help!
  8. I have the following MSSQL query which I was able to get to run on an MSSQL 2005 box. Now I need to migrate it to a MYSQL system. I can't seem to get the syntax quite right. SELECT ed.EntityID, ed.CustomerName, ed.IsActive, pd.ProductLine, pd.ProductVersion FROM ENTITY_DATA ed INNER JOIN (SELECT row_number() over(partition by EntityID order by PollingID desc) as seq, ProductLine, ProductVersion, EntityID, PollingID FROM POLLING_DATA) pd ON ed.EntityID = pd.EntityID WHERE seq = '1' AND ed.IsActive = '1' The goal of the query is to select the most recent instance from the POLLING_DATA for the specific EntityID. In the ENTITY_DATA table, a single entry is created for each customer. In the POLLING_DATA table, multiple entries are created for each customer, each entry containing the specific version of software they are running. I need to select the customer number and name from the ENTITY_DATA table and the most recent version information from the POLLING_DATA table.
  9. I am attempting to run an mssql query and am receiving several errors: Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near the keyword 'JOIN'. (severity 15) in D:\XAMPP\xampp\htdocs\index.php on line 23 Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near 'POLLING_DATAON'. (severity 15) in D:\XAMPP\xampp\htdocs\index.php on line 23 Warning: mssql_query() [function.mssql-query]: Query failed in D:\XAMPP\xampp\htdocs\index.php on line The $query is defined as: $query = "SELECT ENTITY_DATA.CustomerName, POLLING_DATA.ProductLine, POLLING_DATA.ProductVersion"; $query .= "FROM ENTITY_DATA INNER JOIN (SELECT row_number() over(partition by EntityID order by PollingID desc) as seq, ProductLine, ProductVersion, EntityID, PollingID FROM POLLING_DATA) POLLING_DATA"; $query .= "ON ENTITY_DATA.EntityID = POLLING_DATA.EntityID"; $query .= "WHERE POLLING_DATA.seq = 1"; With a more simple query (such as SELECT * FROM POLLING_DATA), there is not a problem and the anticipated results are returned. The more advanced query runs fine in SQL, so the problem seems to be with the way it is being interpreted by PHP (or with the syntax I am using). Any help would be much appreciated!
×
×
  • 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.