这是我的主要代码
if (isset($_POST))
{
include('connection.php');
$query = "call pgetuseridfromemail('" . $_SESSION['email']. "')";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_assoc($result);
$userid = $row['idusers'];
$query = "SELECT * FROM USERS";
$result = mysqli_query($conn, $query) or die("query no executed");
while($row = mysqli_fetch_assoc($result))
{
echo $row['USERNAME'];
}
}
这是我与数据库的连接
session_start();
$user = "root";
$pass = "";
$hostname = "localhost";
$database = "faana final";
//conection to database
$conn = mysqli_connect($hostname, $user, $pass, $database) or die(mysql_error());
这是我的商店程序
BEGIN
select idusers from users where email = email1;
END
我无法执行查询,因为它回显query not executed
答案 0 :(得分:1)
表名在MySql中区分大小写,取决于Operating System:
$query = "SELECT * FROM USERS";
select idusers from users where email = email1;
您可能会打印mysql错误,如下面的几行:
$result = mysqli_query($conn, $query1) or die(mysql_error()); //die("query no executed");
答案 1 :(得分:0)
在代码行$query1
中使用$query
而不是$query = "SELECT * FROM USERS";
,反之亦然。