-3
このコードについて何が間違っていますか?リソースID#9リソースID#10リソースID#11:どうすれば他のデータベースから何かを出すことができますか?
echo "<table>";
echo "<tr><td>Machine Nummer</td><td>Eigenaar</td><td>Status</td><td>Locatie</td></tr>";
while($row = mysql_fetch_array($result)){
echo "<tr><td>" . $row['machineid'] . "</td><td> ". $eigenaar=mysql_query("SELECT userName FROM users WHERE userId =" . $row['eigenaar'] ."") ."</td><td>" . $row['status'] . "</td><td>" . $row['locatie'] . "</td></tr>";
}
echo "</table>";
$res=mysql_query("SELECT * FROM users WHERE userId=".$_SESSION['user']);
$userRow=mysql_fetch_array($res);
$query = "SELECT * FROM machines WHERE locatie='".$_SESSION['location']."'"; //You don't need a ; like you do in SQL
$result = mysql_query($query);
私は出力にはuserIdに等しいが、私は唯一の出力を得るeigenaar名前をそれをしたいです。
馬の前にワゴンを載せているので、*それはエコーの中にクエリーを置くことができないためです。 –
* "このコードについて何が間違っていますか?" * A:すべて。それはまったくナンセンスです。マルクが言うように、カーゴ・カルト・プログラミングがあります。 –
*** [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/wiki/Prepared_statement)について学んでください。 )[PDO](http://php.net/manual/en/pdo.prepared-statements.php)と[MySQLi](http://php.net/manual/en/mysqli.quickstart.prepared- statements.php)、PDOの使用を検討してください。[これは本当に簡単です](http://jayblanchard.net/demystifying_php_pdo.html)。 –