やったことある :
$resource = mysql_query("SELECT * FROM table WHERE id = " . $id);
$user = mysql_fetch_assoc($resource);
echo "Hello User, your number is" . $user['number'];
mysql ステートメントはすべて非推奨であり、使用すべきではないと読みました。
PDOでこれを行うにはどうすればよいですか?
最初の行は次のようになります。
$stmt = $db->prepare("SELECT * FROM table WHERE id = " . $id); // there was an aditional double quote in here.
$stmt->execute(array(':id' => $id));
mysql_fetch_assoc() 関数はどうですか?
私はphpを使用しています