相关疑难解决方法(0)

mysql_fetch_array()/ mysql_fetch_assoc()/ mysql_fetch_row()/ mysql_num_rows等...期望参数1是资源或结果

我试图从MySQL表中选择数据,但我收到以下错误消息之一:

mysql_fetch_array()期望参数1是资源,给定布尔值

要么

mysqli_fetch_array()期望参数1为mysqli_result,给定布尔值

要么

在布尔/非对象上调用成员函数fetch_array()

这是我的代码:

$username = $_POST['username'];
$password = $_POST['password'];

$result = mysql_query('SELECT * FROM Users WHERE UserName LIKE $username');

while($row = mysql_fetch_array($result)) {
    echo $row['FirstName'];
}
Run Code Online (Sandbox Code Playgroud)

这同样适用于代码

$result = mysqli_query($mysqli, 'SELECT ...');
// mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given
while( $row=mysqli_fetch_array($result) ) {
    ...
Run Code Online (Sandbox Code Playgroud)

和

$result = $mysqli->query($mysqli, 'SELECT ...');
// Call to a member function fetch_assoc() on a non-object
while( $row=$result->fetch_assoc($result) ) {
    ...
Run Code Online (Sandbox Code Playgroud)

和

$result = $pdo->query('SELECT ...', PDO::FETCH_ASSOC);
// Invalid …
Run Code Online (Sandbox Code Playgroud)

php mysql

938
推荐指数
29
解决办法
74万
查看次数

警告:stream_socket_client():无法设置私钥文件

在php simplepush.php中在终端中运行PHP时无法获得这些错误

Warning: stream_socket_client(): Unable to set private key file `/users/accenture/Desktop/newAPNS/ck.pem' in /users/accenture/Desktop/newAPNS/simplepush.php on line 22

Warning: stream_socket_client(): failed to create an SSL handle in /users/accenture/Desktop/newAPNS/simplepush.php on line 22

Warning: stream_socket_client(): Failed to enable crypto in /users/accenture/Desktop/newAPNS/simplepush.php on line 22

Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /users/accenture/Desktop/newAPNS/simplepush.php on line 22

Failed to connect: 0 
Run Code Online (Sandbox Code Playgroud)

我使用raywenderlich文章创建了所有证书和pem文件,http: //www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1#comments

php ssl ios

21
推荐指数
2
解决办法
2万
查看次数

标签 统计

php ×2

ios ×1

mysql ×1

ssl ×1