Reputation: 348
I have a simple Form I am trying to code to get a handle on recoding a php page from drupal to linux. I Don't think I have access to all the old code, but doing my best. Here is the HTML code:
<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>
And then here is the 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;
?>
I've tried cutting it down to just the lines of
$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>";
And it just returns a blank page, where I thought at least those 3 lines would return an empty table with a header. I thought it was supposed to return in the page I was at, the table in the place of the form. What am I doing wrong here
Upvotes: 0
Views: 69
Reputation: 31749
Try with -
$content = "<table border='0'><tr><td colspan='3'><strong>Keylog Report: All Keyset/Keys</strong></td></tr>";
//rest of the code
echo $content;
Upvotes: 0
Reputation: 2641
Seems like error reporting is not enabled.
error_reporting(E_ALL);
ini_set('display_errors', 'On');
You can enable it either in code with the lines above or globally in php.ini
Upvotes: 0