だから、私はオンラインで回答を探すことを試みてきましたが、私は答えを得ていないようです。私は http://php.net のPHPリファレンスをすべて読んできましたが、このための具体的な答え..とにかく。
私の質問は:
私は、HTMLファイルにロードされたPHPソースファイルを持っています:
<form name="input" action="register.php" method="get">
User: <input type="text" name="user" />
Pass: <input type="text" name="pass" />
<input type="submit" value="Submit" />
</form>
これまでのところとても良い、そうですか?ですから、私はこの.phpファイルを持っています:
<?php
$db = new PDO('sqlite::database:');
$a = $_GET['user'];
$b = $_GET['pass'];
$firstSearchF = $db->prepare('SELECT nome FROM Users WHERE name_U = _nome');
$firstSearchF->bindParam('_nome', $a, PDO::PARAM_STR);
$firstSearchF->execute();
$firstSearch = $firstSearchF->fetch();
if(empty($firstSearch))
{
$final = $db->prepare('INSERT INTO Users (name_u,password) VALUES(nome,passW)');
$final->bindParam('nome', $a, PDO::PARAM_STR);
$final->bindParam('passW', $b, PDO::PARAM_STR);
$final->execute();
echo 'User Registered Successfully!';
}
else
{
echo 'Sorry, but the requested user already exists in the database. Try again!';
}
?>
フォームに何かを入力してsubmitを押すと、出力は次のようになります:
"prepare('SELECT nome FROM Users WHERE name_U = _nome'); $firstSearchF->bindParam('_nome', $a, PDO::PARAM_STR); $firstSearchF->execute(); $firstSearch = $firstSearchF->fetch(); if(empty($firstSearch)) { $final = $db->prepare('INSERT INTO Users (name_u,password) VALUES(nome,passW)'); $final->bindParam('nome', $a, PDO::PARAM_STR); $final->bindParam('passW', $b, PDO::PARAM_STR); $final->execute(); echo 'User Registered Successfully!'; } else { echo 'Sorry, but the requested user already exists in the database. Try again!'; } ?>"
The only problem is that I understand that the output is what's in after the ->. But why does that happen? I just wanted to test this out, and I can't make the outputs work, as in, what's after the echos.
これを解決するには何ができますか?何か案は?手前にありがとう。 ^^