-2
私は割り当て作業中です。3aStudent_Slip.phpから "slip_id"を選択して4aservice_request.phpに渡す必要があります。 PHPコードでビルドされているテーブルを作成します。私はPHPクラスを持っていないので、なぜそれがサーバー上の "ProgrammingDatabase"からデータベースを取得していないのかと本当に苦労しています。次のコードを使用してmysql db data ....をPHPで入手できません
...コメントのいくつかはすでに述べたように
<?php
require_once('auth.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Service Requests</title>
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="innerWrapper">
<h1>Service request by <?php echo $_SESSION['SESS_FIRST_NAME'];?></h1>
<a href="index.php">Login Page</a> |
<a href="amenu.php">Menu Page</a> |
<a href="logout.php">Logout</a>
<?php
$slip_id = strtoupper($_POST['slip_id']);
echo("<h2>Services for Slip ID $slip_id</h2>");
//Verify Password
$vlogin=$_SESSION['vlogin'];
$vpassword=$_SESSION['vpasswd'];
//Connection String
$con=mysql_connect("localhost", $vlogin, $vpasswd);
if(!$con)
{
die("Could not connect".mysql_error());
}
//Select Database
mysql_select_db("ProgrammingDatabase", $con);
//The actual SQL code goes below into the structured variable $result
$result=mysql_query("SELECT * FROM service_request");
//Constructing the table and column names
echo "<table border='1'>
<tr>
<th>Service ID</th>
<th>Description</th>
</tr>";
//Looping until there are no more records from $result
//If there are records, print the column for that row
//do the while loop below with the variables from $result
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>".$row['service_id']."</td>";
echo "<td>".$row['description']."</td>";
echo "</tr>";
}
echo "</table>";
//Close the SQL connection string
mysql_close($con);
?>
<br />
<form action="a4Services_Student.php " method="post">
<br />
</form>
</div>
</body>
</html>
ここでの例があります:// stackoverflowの.com/questions/60174/how-can-i-prevent-sql-injection-in-php)を参照してください。 [文字列をエスケープする](http://stackoverflow.com/questions/5741187/sql-injection-that-gets-around-mysql-real-escape-string)でも安全ではありません! –
[mysql_ *関数の使用をやめてください](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php)。 [これらの拡張機能](http://php.net/manual/en/migration70.removed-exts-sapis.php)はPHP 7で削除されました。[prepared](http://en.wikipedia.org/ [PDO](http://php.net/manual/en/pdo.prepared-statements.php)および[MySQLi](http://php.net/manual/en/mysqli.quickstart)のwiki/Prepared_statement)ステートメント.prepared-statements.php)、PDOの使用を検討してください。[これは本当に簡単です](http://jayblanchard.net/demystifying_php_pdo.html)。 –
開かれた '<?php'タグ' error_reporting(E_ALL);の直後にファイルの先頭にエラー報告を追加します。 ini_set( 'display_errors'、1); ' –