Jump to content

Moron

Members
  • Posts

    369
  • Joined

  • Last visited

Everything posted by Moron

  1. Thanks, but it's resolved. It was a matter of replacing the "ntwdblib.dll" file on the server with the PHP code accessing the database. As for how it suddenly stopped working, I have no idea.
  2. I coded an employee information system a few years ago and it has evolved all along, with new features being added and such. Well, we recently added a new SQL 2008 server and migrated it all over there. This was done by a consultant and he basically migrated all databases and user accounts to the new server. I changed my code to point to the new server and it worked like a champ. That is, until a couple of days ago....... It worked great for the last month and a half. Now, it suddenly won't connect any longer ("Unable to connect to database _____....."). I can change the code to point back to the old server and it works fine again. One of the other guys double- and triple-checked the accounts on the new server and they match. The old server is SQL Server 2000. The new one is SQL server 2008 R2. Any help is greatly appreciated!
  3. I think it is. It seems that I get a different formatting with Notepad as opposed to Notepad++ as opposed to Wordpad, etc.... Thanks! I'll experiment with adding some more elements.
  4. Sure. It is: <?php $tmp = array(); ?> <?php $AccountNumber = "00040"; if ($AccountNumber = 00040) { $tmp[] = "<ACCOUNT_NO>"; $tmp[] = "Account Number is 00040"; $tmp[] = "</ACCOUNT_NO>\n"; } else { $tmp[] = "<ACCOUNT_NO>"; $tmp[] = "Account Number is not 00040"; $tmp[] = "</ACCOUNT_NO>\n"; $tmp[] = ''; } ?> <?php $AccountName = "Microsoft"; if ($AccountName = "Microsoft") { $tmp[] = "<ACCOUNT_NAME>"; $tmp[] = "Account Name is Microsoft"; $tmp[] = "</ACCOUNT_NAME>\n"; } else { $tmp[] = "<ACCOUNT_NAME>"; $tmp[] = "Account Name is not Microsoft"; $tmp[] = "</ACCOUNT_NAME>\n"; } ?> <?php file_put_contents('accounts.txt',implode("\n",$tmp)); ?>
  5. Yeah, that's what I meant, the same as a "<BR>" tag in HTML. But the above didn't work. It kept everything on one line.
  6. Thanks! That did it. There is still one issue, though. This... <?php $tmp[] = ''; ?> ...isn't putting in a page break. In fact, I can't tell that it does anything.
  7. Here's my entire code: <?php $tmp = array(); ?> <?php $AccountNumber = "00040"; if ($AccountNumber = 00040) { $tmp[] = "<ACCOUNT_NO>"; $tmp[] = "Account Number is 00040"; $tmp[] = "</ACCOUNT_NO>"; } else { $tmp[] = "<ACCOUNT_NO>"; $tmp[] = "Account Number is not 00040"; $tmp[] = "</ACCOUNT_NO>"; } ?> <?php $tmp = array(); ?> <?php $AccountName = "Microsoft"; if ($AccountName = "Microsoft") { $tmp[] = "<ACCOUNT_NAME>"; $tmp[] = "Account Name is Microsoft"; $tmp[] = "</ACCOUNT_NAME>"; } else { $tmp[] = "<ACCOUNT_NAME>"; $tmp[] = "Account Name is not Microsoft"; $tmp[] = "</ACCOUNT_NAME>"; } ?> <?php file_put_contents('accounts.txt',implode("\n",$tmp)); ?> It only gives me: <ACCOUNT_NAME>Account Name is Microsoft</ACCOUNT_NAME> It only gives me the <ACCOUNT_NO> tags and value if I add the file_put_contents within each IF section. EDIT: I'm using "accounts.txt" just for simplicity. Notepad is quick and easy.
  8. Yeah, I know, but I'm just keeping it as simple as possible for my testing tonight. If I can get this right, I'll switch it back to writing XML.
  9. A couple of things.... if I put the file_put_contents only at the end, it only gives me the results of the last "if" statement. What am I doing wrong there? I need the page break because each set of <PARAMETERS></PARAMETERS> needs to be enclosed. Plus, I need easier readability.
  10. Okay, after playing with the code a bit tonight (I don't have the database connection at home), I got this to do what I want: <?php $tmp1 = array(); $AccountNumber = "00040"; if ($AccountNumber = 00040) { $tmp1[] = "<ACCOUNT_NO>"; $tmp1[] = "Account Number is 00040"; $tmp1[] = "</ACCOUNT_NO>"; file_put_contents('accounts.txt',implode("\n", $tmp1),FILE_APPEND); } else { $tmp1[] = "<ACCOUNT_NO>"; $tmp1[] = "Account Number is not 00040"; $tmp1[] = "</ACCOUNT_NO>"; file_put_contents('accounts.txt',implode("\n", $tmp1),FILE_APPEND); } $tmp = array(); $AccountName = "Microsoft"; if ($AccountName = "Microsoft") { $tmp[] = "<ACCOUNT_NAME>"; $tmp[] = "Account Name is Microsoft"; $tmp[] = "</ACCOUNT_NAME>"; file_put_contents('accounts.txt',implode("\n", $tmp),FILE_APPEND); } else { $tmp[] = "<ACCOUNT_NAME>"; $tmp[] = "Account Name is not Microsoft"; $tmp[] = "</ACCOUNT_NAME>"; file_put_contents('accounts.txt',implode("\n", $tmp),FILE_APPEND); } ?> The resulting output is: <ACCOUNT_NO>Account Number is 00040</ACCOUNT_NO><ACCOUNT_NAME>Account Name is Microsoft </ACCOUNT_NAME> How do I make a page break after each closing tag, like after </ACCOUNT_NO> above in the file I'm writing?
  11. Thanks a ton! It works. Now I just have to get all of the other parameters set up.
  12. <?php $connection statement; //QUERY - See explanation below $RESULTDS=mssql_query("SELECT DISTINCT UB.[ACCOUNT_NO], UB.[ACCOUNT_NAME] FROM TABLE ORDER BY UB.[ACCOUNT_NO]"); $RESULT=mssql_fetch_assoc($RESULTDS); ?> <?php if ($RESULT['PBS_ACCOUNT_ID'] >= 00000001) { echo "<font size=2 color=#000000 face=arial> <</font>"; echo "<font size=2 color=#000000 face=arial>PBS_ACCOUNT_ID</font>"; echo "<font size=2 color=#000000 face=arial>></font>"; echo "<B>"; echo $RESULT['PBS_ACCOUNT_ID']; echo "</B>"; echo "<font size=2 color=#000000 face=arial><</font>"; echo "<font size=2 color=#000000 face=arial>/PBS_ACCOUNT_ID"; echo "<font size=2 color=#000000 face=arial>></font>"; echo "<BR>"; } else { echo "<font size=2 color=#000000 face=arial> <</font>"; echo "<font size=2 color=#000000 face=arial>PBS_ACCOUNT_ID</font>"; echo "<font size=2 color=#000000 face=arial> xsi:nil=\"true\"</font>"; echo "<font size=2 color=#000000 face=arial>/</font>"; echo "<font size=2 color=#000000 face=arial>></font>"; echo "<BR>"; } That's a snippet and the rest is more of the same. The output is laid out like the requesting agency wants in the XML schema. I just want it to write the file instead of having to copy and paste from the results page.
  13. Almost, but drop Step #3. I already have the output displayed as the XML format we need. Once the page completes pulling data, we can Select All, Copy and Paste into (whatever editor) and save as XML. So basically, if we can just write the output straight to XML (technically, straight ASCII text would be fine because it's already formatted), that'll do the trick. Thanks!
  14. The server. Specifically, I'll set up a folder for the files and share it out.
  15. Thanks, but this isn't Linux-based. It's running on IIS on a Windows server.
  16. I just wrote a php page that pulls live data from a database and presents it in an XML layout. In Internet Explorer, I can Edit, Select All, then Copy-Paste and save as XML. The resulting XML works fine. In Firefox, I can click File, Save Page As, select Text Files, then name it as an XML. Again, it works fine as XML. So..... how do I skip the Copy/Paste (IE) or Save Page As (Firefox) steps and write the output directly to an XML file? I've played with stdout(), buffers, page capturing utilities (wget, cURL, httrack, etc....), but no luck so far. This creates a pretty intense page due to the amount of data involved (1.3+ MB). Any help is appreciated!
  17. If the PBS_ACCOUNT_ID field is empty, it echoes: "<PBS_ACCOUNT_ID> </PBS_ACCOUNT_ID>," not "HELLO." So what am I doing wrong?
  18. (Please ignore HTML formatting) if (is_null($RESULT['PBS_ACCOUNT_ID'])) { echo "<font size=2 color=#000000 face=arial> <</font>"; echo "<font size=2 color=#000000 face=arial>PBS_ACCOUNT_ID</font>"; echo "<font size=2 color=#000000 face=arial>></font>"; echo "<font size=2 color=#000000 face=arial>HELLO</font>"; echo "<font size=2 color=#000000 face=arial><</font>"; echo "<font size=2 color=#000000 face=arial>/PBS_ACCOUNT_ID</font>"; echo "<font size=2 color=#000000 face=arial>></font>"; } else { echo "<font size=2 color=#000000 face=arial> <</font>"; echo "<font size=2 color=#000000 face=arial>PBS_ACCOUNT_ID</font>"; echo "<font size=2 color=#000000 face=arial>></font>"; echo "<B>"; echo $RESULT['PBS_ACCOUNT_ID']; echo "</B>"; echo "<font size=2 color=#000000 face=arial><</font>"; echo "<font size=2 color=#000000 face=arial>/PBS_ACCOUNT_ID</font>"; echo "<font size=2 color=#000000 face=arial>></font>"; echo "<BR>"; } If the PBS_ACCOUNT_ID field is empty, it just shows blank. Why doesn't it echo "HELLO?" Or should I be using "IS_EMPTY?"
  19. I tried the <pre></pre> tags but they also cause a carriage break and that won't work. Maybe I can find a way to have "&" and "amp" and ";" all line up together but not be read as a tag.
  20. Great point and I hadn't caught that. So since this will be copied and pasted as an XML document, I guess I need to make it actually display "$amp;." Thanks. That helps.
  21. What I want to do should be very simple, but I've stared at code all day and can't grasp it. I want to replace the "&" character, if it exists, with the "&" string. What I have is: $name = $RESULT['ACCOUNT_NAME']; $cleaned = str_replace('&','& ', $name); echo $cleaned; It doesn't crash or anything, but it doesn't work. I have several ampersand (&) characters in my output that aren't getting replaced. Any help is appreciated.
  22. Never mind. It's fixed. A certain dummy ( ) was editing the wrong version of the file....
  23. Okay, my organanization has a page that we really need to autodirect to https:// in case anyone manually types in the http:// version. I've tried this (among many others) and it just sits there like a knot on a log: <?php header( "Location: https://www.mywebsite.com/myfile.php" ) ; ?> Any ideas? It just simply doesn't redirect. It just sits there in its http:// format. I've also tried numerous other methods. None of them worked, either, but this is the simplest. Thanks!
  24. I forgot this part. This is MS SQL Server 2000, so maybe the XML export function didn't appear until a later version.
  25. That was my first thought, but I can't seem to find an XML option in there (it seems to have everything else).
×
×
  • 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.