我有一个简单的表单,我正在尝试编写代码以获取从drupal到linux重新编码php页面的句柄。我不认为我可以访问所有旧代码,但我会尽力而为。 这是HTML代码:
<form accept-charset="UTF-8" method="post" action="keyset_checkin.php">
<div>
<label for="edit-keysetnumber">Serial Number: </label>
<input type="text" maxlength="128" name="keysetnumber" size="60" value="" />
</div>
<input type="submit" name="op" value="Check In Keyset" />
</form>
然后是PHP:
<?php
$dbhost = '*********';
$dbuser = '*********';
$dbpass = '*********';
$dbname = '*********';
$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
mysql_select_db($dbname);
/*$content .= backLink();
$content .= "<table border='0'><tr><td colspan='3'><strong>Keylog Report: All Keyset/Keys</strong></td></tr>";
$content .= "</table>";
return $content;
*/
$content .= "<table border='0'><tr><td colspan='3'><strong>Keylog Report: All Keyset/Keys</strong></td></tr>";
$query = "SELECT keysetnumber,keyring_id,building FROM {keyinv_key_sets} WHERE building NOT LIKE '%ZONE%' and building NOT LIKE '%SUPV%' GROUP BY keyring_id ORDER BY building ASC";
$result = db_query($query);
if(db_affected_rows() !=0)
{
while($row = db_fetch_object($result))
{
$content .= "<tr><td valign='top'><font size='-3'><strong>$row->building</strong></font></td><td valign='top' width='50' align='center'><font size='-3'><strong>$row->keyring_id</strong></font></td>";
$content .= "<td valign='top'>";
//drupal_set_message($row->keysetnumber);
$query2 = "SELECT keytext, keydescription FROM {keyinv_keyset_keys} WHERE keysetnumber='$row->keysetnumber'";
$result2 = db_query($query2);
//drupal_set_message("Made it here");
while($row2 = db_fetch_object($result2))
{
//drupal_set_message("Got Here");
$content .= "<font size='-3'>$row2->keytext <font color='#CCCCCC'>($row2->keydescription)</font><font> ";
}
$content .= "</td></tr>";
}
}
else
{
$content .= "<tr><td>No Results</td></tr>";
}
$content .= "</table>";
return $content;
?>
我已经尝试将其简化为
$content .= "<table border='0'><tr><td colspan='3'><strong>Keylog Report: All Keyset/Keys</strong></td></tr>";
$content .= "<tr><td>No Results</td></tr>";
$content .= "</table>";
它只返回一个空白页面,我认为至少这3行会返回一个带有标题的空表。我以为它应该在我所在的页面返回,表格在表格的位置。我在这做错了什么
答案 0 :(得分:2)
尝试回显结果($ content)而不返回结果。
答案 1 :(得分:0)
似乎未启用错误报告。
error_reporting(E_ALL);
ini_set('display_errors', 'On');
您可以在上面的代码中使用,也可以在php.ini
中全局启用它答案 2 :(得分:0)
尝试 -
$content = "<table border='0'><tr><td colspan='3'><strong>Keylog Report: All Keyset/Keys</strong></td></tr>";
//rest of the code
echo $content;