Jump to content

Moron

Members
  • Posts

    369
  • Joined

  • Last visited

Posts posted by Moron

  1. As the title says.... we have an old SCO OpenServer box with a database that contains archived info. We can't shut it down for this reason. I found an old database export from years ago in .DBF format, which I can easily convert to an Excel spreadsheet. But the problem is that it's the newest export we have and it's from 2006. I need one that covers through 2013 after they stopped inputting data.

    Is there a way to either:

    1. Run another export?

    2. Connect to it via ODBC (I have the root credentials)?

    If I can somehow get this database into Windows in whatever format, we can shut this box down. Another "option" is to virtualize it, but that's complicated and it sounds like putting lipstick on a pig to me.

    All help is appreciated.

     

     

  2. And when you open in Windows Explorer and from the browser do they open in the same app?

     

    No, From Windows Explorer, they open in Notepad. From the browser, they open in a browser window.

     

    You can hover the mouse over each file listed and look at the bottom bar of the browser, and it will be pointing to a different file name. That's why they aren't matching.

  3. Now there's a weird problem. I navigate to the folder in Windows Explorer and click a file, it has tons of information. I click it from this PHP page and it has just a couple of lines. It's obviously a different file, but the names match exactly.

     

    This is total Twilight Zone.

     

    Ideas?

  4.  

    You had a lot of unneeded code. The one line lists all files and sorts them by date descending. There are different ways to handle the path, but this should work fine:

    $path = "../FOLDER/Subfolder";
    array_multisort(array_map('filemtime', ($files = glob("$path/*.*"))), SORT_DESC, $files);
    
    foreach($files as $file) {
        echo "<a href='$file' target=\"\_blank>".basename($file)."</a><br />";
    }

    Thanks. That's closer, but it's sorting by file name (descending) and I need it to sort by file modified date (also descending, newest on top).

  5. I'm displaying the contents of a folder, with each file clickable.

     

    I can't seem to get it to sort by file date, with the most current on top (descending).

     

    What am I missing here?

     

     

    <?php
    
    echo "<h1>File Listing</h1>";
    
    $content_array = array();
    
    
    $path = "../FOLDER/Subfolder/";
    
    $dh = opendir($path);
    
    $handle=opendir($dirname);
    $i=0;
    while (($file = readdir($dh)) !== false) {
    
    
    if ($file != "." && $file != "..")
    {
           $content_array[$i][0] = $file;
           $content_array[$i][1] = date ("Y m d", filemtime($dirname."/".$file));
            $i++;
    }
    
    foreach($content_array as $res)
           $sortAux[] = $res[1];
        array_multisort($sortAux, SORT_DESC, $content_array);
    
        echo "<a href='$path/$file' target=\"\_blank>$file</a><br />";
    }
    closedir($dh);
    ?>

     

     

  6. You are likely getting a fatal runtime error (undefined sqlsrv_connect function call.)

     

    PLEASE check and show us what the phpinfo() output shows for the error_reporting and display_errors settings.

     

    By making the first <? opening tag a short one, your connection logic is not seen as being php code (if you do a 'view source' of the partially working page, you should see the short opening tag, the two lines of raw php code, and the first closing ?> tag. When you use a full <?php tag, those two lines of code are being executed and execution probably halts at that point, which is why you need to have and confirm (through testing if needed) that php's error_reporting is set to E_ALL and display_errors is set to ON.

     

    Another thought just occurred. You likely have output_buffering turned ON in your master php.ini and your header() redirects on the page are discarding any php output error messages. If output_buffering is turned on, you should turn it OFF ASAP (stop and restart your server to get any changes made to your master php.ini to take effect and confirm that the setting actually changed by using a phpinfo() statement.)

     

    Just wanted to let you know that I'm still here. I had a family emergency earlier in the week and finally got to revisit this yesterday.

     

    There are two php.ini files on this server (2008 R2, IIS 7.0); one in C:\Windows and one in C:\Program Files (x86)\PHP\v5.3\php.ini. I made your recommended changes to BOTH because I'm still confused between "Configuration File (php.ini) Path," which points to C:\Windows, and "Loaded Configuration File," which points to C:\Program Files (x86)\PHP\v5.3\php.ini. As in, which is the "real" one?

     

    Anyway, after making your recommended changes to BOTH php.ini files, I not only stopped and restarted the website through Internet Services Manager, I also stopped and restarted the World Wide Web Publishing Service. Still, phpinfo() shows exactly ZERO changes; error_reporting is still set to "22527" and display_errors is still set to "Off," pretty as you please.

     

    So until I can figure out what this boneheaded crap is, I can't implement your suggestions. And quite frankly, this is making me feel like a total idiot.

     

  7. Okay, I have an update and it gets weirder by the minute. I replaced the "<?" tags with "<?php." All fine and good.

     

    Except......I can't do this on the very first tag. If I use the short tag, I get this:

     

    phpblank.jpg

     

    I know the data is there (and plenty of it), yet it shows me nothing. If I use the long tag, only on this first tag at the top, I get a blank page.

     

     

  8. Thanks, everyone, and sorry about my delayed response. What a day.

     

    Okay, from the top.....

     

    I went back and removed all of the suppressors (@) from the code.

     

    PFM, you are correct. I did exactly that, searched and replaced "<?" with "<?php." I'll go back in and fix that.

     

    For some reason, it no longer displays the php code when I right-click and View Source. I don;t know what "fixed" that.

     

    And again, I appreciate everyone's suggestions.

     

     

  9. Ok I have checked your code and would like you to use the following amended code.

     

    I have removed the @  suppressors.  This will show any errors that may have been suppressed.  If you get any errors post them back here.

     

    <?php
    
    $msconnect=sqlsrv_connect('SERVERNAME','username','password') or die ("Could not connect to database: ".sqlsrv_get_last_message());;
    $msdb=sqlsrv_select_db("TableName",$msconnect) or die ("Could not connect to table: ".sqlsrv_get_last_message());;
    
    ?>
    
    <?php
    
    
    if($_POST['THOUSE'] || $_POST['TNSEW'] || $_POST['TSTNAM']) {
    $where = " WHERE	(THOUSE LIKE '%{$_POST['THOUSE']}%' AND TNSEW LIKE '%{$_POST['TNSEW']}%' AND TSTNAM LIKE '%{$_POST['TSTNAM']}%')";
    $order = " ORDER BY THOUSE, TNSEW, TSTNAM";
    } elseif ($_POST['TRECTN']) {
    if (!$_POST['TTAXYRa']) { $_POST['TTAXYRa'] = date("Y"); }
    $where = " WHERE	(TRECTN = '{$_POST['TRECTN']}' AND TTAXYR = '{$_POST['TTAXYRa']}')";
    $order = " ORDER BY TRECTN";
    } elseif($_POST['TNAME1']) {
    $where = " WHERE	(TNAME1 LIKE '%{$_POST['TNAME1']}%')";
    $order = " ORDER BY TNAME1, TNAME2";
    } elseif($_POST['TMAPN'] || $_POST['TMAPA'] || $_POST['TPARCL'] || $_POST['TGROUP'] || $_POST['TPICOD'] || $_POST['TSPCIN']) {
    $where = " WHERE	(TMAPN LIKE '%{$_POST['TMAPN']}%' AND TMAPA LIKE '%{$_POST['TMAPA']}%' AND TPARCL LIKE '%{$_POST['TPARCL']}%' AND TGROUP LIKE '%{$_POST['TGROUP']}%' AND TPICOD LIKE '%{$_POST['TPICOD']}%' AND TSPCIN LIKE '%{$_POST['TSPCIN']}%')";
    $order = " ORDER BY TMAPN,TMAPA,TPARCL";
    
    } else {
    header("location: TestSearch.php");
    }
    
    if ($_POST['TTAXYR'] && !$_POST['TTAXYRa']) {
    $where .= " AND (TTAXYR = ".date("Y").")";
    }
    $order .= ", TTAXYR DESC";
    
    $query = "SELECT TRECTN,TTAXYR, TNAME1, TSTADR, TTXAMT, TTXBAL, THOUSE, TNSEW, TSTNAM
    				FROM viewTAXINFO_FULL
    				$where
    				$order";
    
    $result = @sqlsrv_query($query);
    
    if (@sqlsrv_num_rows($result) == 1) {
    $row = sqlsrv_fetch_assoc($result);
    header("location: TestView.php?TRECTN={$row['TRECTN']}&TTAXYR={$row['TTAXYR']}");
    exit;
    }
    
    ?>
    <html>
    <head>
    <title>CITY OF OAK RIDGE PROPERTY TAX SEARCH RESULTS</title>
    <style>
    <!--
    /* Font Definitions */
    @font-face
    {font-family:Verdana;
    panose-1:2 11 6 4 3 5 4 4 2 4;}
    /* Style Definitions */
    p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin:0in;
    margin-bottom:.0001pt;
    font-size:12.0pt;
    font-family:"Times New Roman";}
    h1
    {margin:0in;
    margin-bottom:.0001pt;
    page-break-after:avoid;
    font-size:12.0pt;
    font-family:"Times New Roman";}
    p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
    {margin:0in;
    margin-bottom:.0001pt;
    font-size:10.0pt;
    font-family:Verdana;
    color:black;}
    p.bodytext, li.bodytext, div.bodytext
    {margin-right:0in;
    margin-left:0in;
    font-size:10.0pt;
    font-family:Verdana;
    color:black;}
    @page Section1
    {size:8.5in 11.0in;
    margin:.2in .2in .2in .2in;}
    div.Section1
    {page:Section1;}
    table {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    }
    -->
    </style>
    <link rel=Original-File href=TestSearch.php>
    <style type="text/css">
    <!--
    .style1 {
    color: #FFFFFF;
    font-weight: bold;
    }
    -->
    </style>
    </head>
    <center>
    <body lang=EN-US topmargin="5" leftmargin="3">
    <div class=Section1>
    
            <table width="480" border="0" cellspacing="1" cellpadding="1">
              <tr>
                <td width="230" bgcolor="#006633"><span class="style1"><center>Owner</center></span></td>
                <td width="190" bgcolor="#006633"><span class="style1"><center>Address</center></span></td>
                <td width="10" bgcolor="#006633"><span class="style1"><center>Tax Year </center></span></td>
                <td width="25" bgcolor="#006633"><span class="style1"><center>Tax Amount</center></span></td>
                <td width="25" bgcolor="#006633"><span class="style1"><center>Balance </center></span></td>
    	<td width="25" bgcolor="#006633"><span class="style1"><center>Receipt </center></span></td>
              </tr>
              <?php if (sqlsrv_num_rows($result) > 0) { ?>
    	  <?php while($row = sqlsrv_fetch_assoc($result)) { ?>
              <tr>
                <td bgcolor="#E2E2E2"><a href="TestView.php?TRECTN=<?php= $row['TRECTN']; ?>&TTAXYR=<?php= $row['TTAXYR']; ?>">
                  <?php= $row['TNAME1']; ?>
                  </a> </td>
                <td bgcolor="#E2E2E2">
                  <?php= $row['THOUSE']; ?> <?php= $row['TNSEW']; ?>  <?php= $row['TSTNAM']; ?></td>
                <td bgcolor="#E2E2E2">
                  <div align="center">
                    <?php= $row['TTAXYR']; ?></div></td>
                <td align="right" bgcolor="#E2E2E2">$<?php= number_format($row['TTXAMT'],2); ?></td>
                <td align="right" bgcolor="#E2E2E2">$<?php= number_format($row['TTXBAL'],2); ?></td>
    	<td align="right" bgcolor="#E2E2E2"><?php= ($row['TRECTN']); ?></td>
              </tr>
    	  <?php } ?>
    	  <?php } else { ?>
    	  <tr><td colspan="5">Search yielded no results.</td></tr>
    	  <?php } ?>
    </table>
    
    </center>
    </body>
    </html>
    

     

    Thanks, but.......it still comes up totally blank.

     

  10. You are probably using short open tags <? in some of your files.

     

    You should ONLY use full opening <?php tags so that your php code will always be seen as being php code, regardless of which server it is being run on.

     

    Nope. It's all long tags.

     

    Here's the code:

     

    <?php
    
    $msconnect=sqlsrv_connect('SERVERNAME','username','password') or die ("Could not connect to database: ".sqlsrv_get_last_message());;
    $msdb=sqlsrv_select_db("TableName",$msconnect) or die ("Could not connect to table: ".sqlsrv_get_last_message());;
    
    ?>
    
    <?php
    
    
    if($_POST['THOUSE'] || $_POST['TNSEW'] || $_POST['TSTNAM']) {
    $where = " WHERE	(THOUSE LIKE '%{$_POST['THOUSE']}%' AND TNSEW LIKE '%{$_POST['TNSEW']}%' AND TSTNAM LIKE '%{$_POST['TSTNAM']}%')";
    $order = " ORDER BY THOUSE, TNSEW, TSTNAM";
    } elseif ($_POST['TRECTN']) {
    if (!$_POST['TTAXYRa']) { $_POST['TTAXYRa'] = date("Y"); }
    $where = " WHERE	(TRECTN = '{$_POST['TRECTN']}' AND TTAXYR = '{$_POST['TTAXYRa']}')";
    $order = " ORDER BY TRECTN";
    } elseif($_POST['TNAME1']) {
    $where = " WHERE	(TNAME1 LIKE '%{$_POST['TNAME1']}%')";
    $order = " ORDER BY TNAME1, TNAME2";
    } elseif($_POST['TMAPN'] || $_POST['TMAPA'] || $_POST['TPARCL'] || $_POST['TGROUP'] || $_POST['TPICOD'] || $_POST['TSPCIN']) {
    $where = " WHERE	(TMAPN LIKE '%{$_POST['TMAPN']}%' AND TMAPA LIKE '%{$_POST['TMAPA']}%' AND TPARCL LIKE '%{$_POST['TPARCL']}%' AND TGROUP LIKE '%{$_POST['TGROUP']}%' AND TPICOD LIKE '%{$_POST['TPICOD']}%' AND TSPCIN LIKE '%{$_POST['TSPCIN']}%')";
    $order = " ORDER BY TMAPN,TMAPA,TPARCL";
    
    } else {
    header("location: TestSearch.php");
    }
    
    if ($_POST['TTAXYR'] && !$_POST['TTAXYRa']) {
    $where .= " AND (TTAXYR = ".date("Y").")";
    }
    $order .= ", TTAXYR DESC";
    
    $query = "SELECT TRECTN,TTAXYR, TNAME1, TSTADR, TTXAMT, TTXBAL, THOUSE, TNSEW, TSTNAM
    				FROM viewTAXINFO_FULL
    				$where
    				$order";
    
    $result = @sqlsrv_query($query);
    
    if (@sqlsrv_num_rows($result) == 1) {
    $row = @sqlsrv_fetch_assoc($result);
    header("location: TestView.php?TRECTN={$row['TRECTN']}&TTAXYR={$row['TTAXYR']}");
    exit;
    }
    
    ?>
    <html>
    <head>
    <title>CITY OF OAK RIDGE PROPERTY TAX SEARCH RESULTS</title>
    <style>
    <!--
    /* Font Definitions */
    @font-face
    {font-family:Verdana;
    panose-1:2 11 6 4 3 5 4 4 2 4;}
    /* Style Definitions */
    p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin:0in;
    margin-bottom:.0001pt;
    font-size:12.0pt;
    font-family:"Times New Roman";}
    h1
    {margin:0in;
    margin-bottom:.0001pt;
    page-break-after:avoid;
    font-size:12.0pt;
    font-family:"Times New Roman";}
    p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
    {margin:0in;
    margin-bottom:.0001pt;
    font-size:10.0pt;
    font-family:Verdana;
    color:black;}
    p.bodytext, li.bodytext, div.bodytext
    {margin-right:0in;
    margin-left:0in;
    font-size:10.0pt;
    font-family:Verdana;
    color:black;}
    @page Section1
    {size:8.5in 11.0in;
    margin:.2in .2in .2in .2in;}
    div.Section1
    {page:Section1;}
    table {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    }
    -->
    </style>
    <link rel=Original-File href=TestSearch.php>
    <style type="text/css">
    <!--
    .style1 {
    color: #FFFFFF;
    font-weight: bold;
    }
    -->
    </style>
    </head>
    <center>
    <body lang=EN-US topmargin="5" leftmargin="3">
    <div class=Section1>
    
            <table width="480" border="0" cellspacing="1" cellpadding="1">
              <tr>
                <td width="230" bgcolor="#006633"><span class="style1"><center>Owner</center></span></td>
                <td width="190" bgcolor="#006633"><span class="style1"><center>Address</center></span></td>
                <td width="10" bgcolor="#006633"><span class="style1"><center>Tax Year </center></span></td>
                <td width="25" bgcolor="#006633"><span class="style1"><center>Tax Amount</center></span></td>
                <td width="25" bgcolor="#006633"><span class="style1"><center>Balance </center></span></td>
    	<td width="25" bgcolor="#006633"><span class="style1"><center>Receipt </center></span></td>
              </tr>
              <?php if (@sqlsrv_num_rows($result) > 0) { ?>
    	  <?php while($row = @sqlsrv_fetch_assoc($result)) { ?>
              <tr>
                <td bgcolor="#E2E2E2"><a href="TestView.php?TRECTN=<?php= $row['TRECTN']; ?>&TTAXYR=<?php= $row['TTAXYR']; ?>">
                  <?php= $row['TNAME1']; ?>
                  </a> </td>
                <td bgcolor="#E2E2E2">
                  <?php= $row['THOUSE']; ?> <?php= $row['TNSEW']; ?>  <?php= $row['TSTNAM']; ?></td>
                <td bgcolor="#E2E2E2">
                  <div align="center">
                    <?php= $row['TTAXYR']; ?></div></td>
                <td align="right" bgcolor="#E2E2E2">$<?php= number_format($row['TTXAMT'],2); ?></td>
                <td align="right" bgcolor="#E2E2E2">$<?php= number_format($row['TTXBAL'],2); ?></td>
    	<td align="right" bgcolor="#E2E2E2"><?php= ($row['TRECTN']); ?></td>
              </tr>
    	  <?php } ?>
    	  <?php } else { ?>
    	  <tr><td colspan="5">Search yielded no results.</td></tr>
    	  <?php } ?>
    </table>
    
    </center>
    </body>
    </html>
    

     

    And again, this same code (modified here to remove private info) runs against the same SQL server just fine from another web server.

     

    I'm stumped.

     

  11. Are you sure that it's not showing any data versus PHP crashing and dying? I would bet there's a different problem from the databasework; maybe syntax (are the PHP versions on the old machine and the new machine the same?) maybe settings (how about the php.ini settings?), or maybe something else.

     

    As you should to for a development machine, make sure your new web server's php.ini has

    error_reporting = -1
    display_errors = on

    then restart the web server software (ie, Apache or IIS), run your script(s) again, and look for error messages.

     

    Thanks. I made both changes, saved the file, then stopped and restarted the website in IIS. Same result.

     

     

  12. We're moving to a new web server and we recently migrated to a new MS SQL server, as well. All PHP functions on the old web server were switched to point to the new SQL server and all was well.

     

    But..... Now I''m trying to move my PHP functions to the new web server and it won't connect to the database. PHP works fine because I can echo "Testing" or whatever. I've downloaded the SQL Server PHP drivers from Microsoft, changed the connection string from MSSQL to SQLSRV, updated the PHP.ini file, and taken several other steps. It still can't see the database.

     

    Ideas?

     

    Oh, yeah. And both the new web server and MS SQL server are Server 2008 R2.

     

×
×
  • 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.