sql查询在iis上的prod环境中失败,但在运行apache的测试环境中工作

vxbzzdmp  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(344)

当我上传到实时环境时,当quires在测试环境中完全正常工作时,我遇到了一个quires失败的问题,我在这一点上不知所措,不知道错误可能在哪里,所以我最终崩溃了,决定询问那些可能比我更熟练的stack overflow,如果我错过了什么。quire从两个不同的表中查看序列号信息,以获取系统规格和与父序列号相关的任何硬盘驱动器信息

<?php
$Dev_HDD = 0;

$con=mysqli_connect("localhost","username","user_password","database");
// Check connection
if (mysqli_connect_errno())
    {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }

if (isset($_POST["serial"]))

{
    $SerialNumber = $_POST["serial"];

    $sql ="SELECT system.Manufacturer, system.Model, system.SerialNumber, system.Processor, system.Memory FROM system  WHERE SerialNumber = '" .$SerialNumber. "'" ;

    if ($result=mysqli_query($con,$sql))
    {

        // Fetch one and one row
        while ($row=mysqli_fetch_row($result))
        {
            $System_Manufacturer = $row[0];
            $System_Model = $row[1];
            $System_SerialNumber = $row[2];
            $System_Processor = $row[3];
            $System_Memory = $row[4];

?>

    <table border="0" height="100%" width="100%" align="left" valign="top">
        <tr>
            <td colspan="2">
                <hr />
            </td>
        </tr>

        <tr>
            <td colspan="2" valign="top">System Summary:</td>
        </tr>
        <tr>
            <td colspan="2">
                <hr />
            </td>
        </tr>

        <tr>
            <td>System Manufacturer</td>
            <td>
                <?php echo $System_Manufacturer; ?>
            </td>
        </tr>

        <tr>
            <td>System Model:</td>
            <td>
                <?php echo $System_Model; ?>
            </td>
        </tr>

        <tr>
            <td valign="top">System Serial Number</td>
            <td valign="top">
                <?php echo $System_SerialNumber; ?>
            </td>
        </tr>

        <tr>
            <td valign="top">System Processor</td>
            <td valign="top">
                <?php echo $System_Processor; ?>
            </td>
        </tr>

        <tr>
            <td valign="top">System Memory</td>
            <td valign="top">
                <?php echo $System_Memory; ?>
            </td>
        </tr>

    <?php
}

        // Free result set
        mysqli_free_result($result);
    }
    else
    {
        echo "The serial number specified could not be located<br>";
    }

    $sql ="SELECT device.recid, device.Manufacturer, device.Model, device.SerialNumber, device.Capacity, device.RPM, device.ErasureMethod, device.ErasureResults FROM device WHERE SystemSerialNumber = '" . $System_SerialNumber . "'" ;

    if ($result=mysqli_query($con,$sql))
    {

        // Fetch one and one row
        while ($row=mysqli_fetch_row($result))
        {
            $Dev_Recid = $row[0];
            $Dev_Manufacturer = $row[1];
            $Dev_Model = $row[2];
            $Dev_DeviceSerialNumber = $row[3];
            $Dev_Capacity = $row[4];
            $Dev_RPM = $row[5];
            $Dev_ErasureMethod = $row[6];
            $Dev_ErasureResults = $row[7];

    ?>

    <tr>
        <td colspan="2">
            <hr />
        </td>
    </tr>

    <tr>
        <td colspan="2" valign="top">Storage Summary(<?php echo $Dev_HDD = $Dev_HDD + 1; ?>):</td>
    </tr>

    <tr>
        <td colspan="2">
            <hr />
        </td>
    </tr>

    <tr>
        <td>Hard Drive Manufacturer</td>
        <td>
            <?php echo $Dev_Manufacturer; ?>
        </td>
    </tr>

    <tr>
        <td>Hard Drive Model:</td>
        <td>
            <?php echo $Dev_Model; ?>
        </td>
    </tr>

    <tr>
        <td valign="top">Serial Number Lookup</td>
        <td valign="top">
            <?php echo $Dev_DeviceSerialNumber; ?>
        </td>
    </tr>

    <tr>
        <td valign="top">Hard Drive  Capacity</td>
        <td valign="top">
            <?php echo $Dev_Capacity; ?>
        </td>
    </tr>

    <tr>
        <td valign="top">Hard Drive  Speed</td>
        <td valign="top">
            <?php echo $Dev_RPM; ?>
        </td>
    </tr>

    <tr>
        <td>Erasure Method:</td>
        <td>
            <?php echo $Dev_ErasureMethod; ?>
        </td>
    </tr>

    <tr>
        <td>Erasure Results:</td>
        <td>
            <?php echo $Dev_ErasureResults; ?>
        </td>
    </tr>

    <tr>
        <td>Parent Serial Number:</td>
        <td>
        <?php echo "<a href='logs/" .$Dev_DeviceSerialNumber.".log' target='_blank'>".$Dev_DeviceSerialNumber."</a> <br>";?>
        </td>
    </tr>
</table>

<?php
        }
    }

        // Free result set
        mysqli_free_result($result);

    mysqli_close($con);
}
?>

<?php

        echo " <br>";

        echo "<pre></pre>";
?>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题