-2
を返して:mysqlのは、私はテーブルのユーザーからユーザー名を取得する必要がありますが、私はmysql_real_escape_stringの使用していますが、それは私にエラーを与えているエラー
(!) Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\wamp64\www\final-project\profile.php on line 4
(!) Error: Call to undefined function mysql_real_escape_string() in C:\wamp64\www\final-project\profile.php on line 4
Call Stack
# Time Memory Function Location
1 0.0014 368024 {main}() ...\profile.php:0
コードは次のとおりです。
<?php include("./inc/header.inc.php");?>
<?php
if(isset($_GET['u'])) {
$username = mysql_real_escape_string($_GET['u']);
if(ctype_alnum($username)){
//check if user exist
$check = DB::query("SELECT username FROM users WHERE username='$username'");
if(mysql_num_rows($check)==1){
$get = mysql_fetch_assoc($check);
$username = $get['username'];
}else{
echo "<meta http-equiv=\"refresh\"0; url=http://localhost/final-project/index.php\">";
exit();
}
}
}
?>
<h2>Profile page for : <?php echo "$username";?></h2>
if(isset($ _ GET ['u']))はユーザ名を返しています
フレッド私はそれが重複していることを知っていますが、私はあなたの時間のためにそれを修正する方法を知らなかった – karim