我正在使用MySQLi连接,并且我有下面的代码,我试图从数据库表中定义库存ID所定义的行的所有列,但是我无法得到这个工作。我是否完全错误的方式?我希望能够在选择查询之后的代码中使用$row['general_cleanliness']
之类的内容。mysqli的问题全部选中
$getScheduleCondition = $db->prepare("SELECT * FROM inventories WHERE inventory_id = ? LIMIT 1",)){
$getScheduleCondition->bind_param("i", $inventory);
$row = $getScheduleCondition->fetch_array();
$getScheduleCondition->close();
$inventory
被定义为一个数字,我知道这工作。任何帮助表示赞赏,对不起,如果这似乎是一个基本问题,只是有点混乱!
编辑: 给大家告诉我,我使用的PDO,我不是:
$db = new mysqli('localhost', 'cl52-system', 'PASS', 'cl52-system');
if($db->connect_errno > 0){
die('Unable to connect to database [' . $db->connect_error . ']');
}
“选择数据库中的所有行” - 但为什么在你的代码中,你通过id选择并设置限制1? – sergio
你永远不会执行查询(http://www.php.net/manual/en/mysqli-stmt.execute.php) – Sumurai8
@sergio对不起,我的意思是专栏! –