通知是什么:资源ID#9? [英] what is the notice: resource id#9?

查看:91
本文介绍了通知是什么:资源ID#9?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
从PHP的MySql响应中回显资源ID#6"?

Possible Duplicate:
How do i "echo" a "Resource id #6" from a MySql response in PHP?

我创建了一个SELECT查询,但有一个错误.当我print_r(result)我得到资源ID#9 注意这里的代码是:

I created a SELECT query but it has an error. When I print_r(result) I get the resource id#9 notice here is the code:

$query= "SELECT * FROM {$hotel_name} WHERE Bdate BETWEEN {$chack_in} AND {$chack_out}";

$availability = mysql_query($query);

confirm_query($availability);

print_r($availability);

推荐答案

'$ availability`打印为'resource id#9',因为它是资源. http://php.net/manual/en/language.types.resource.php

'$availability` prints as 'resource id#9' because it is a resource. http://php.net/manual/en/language.types.resource.php

这没有错,这是预料之中的.当查询成功执行时,mysql_query返回资源类型;当查询执行失败时,false返回资源类型.您可以在该资源上调用mysql_fetch_*($resource)来从中获取数据.

There is nothing wrong with this, it is expected. mysql_query returns resource types when the query executes successful, and false when it fails. You can call mysql_fetch_*($resource) on that resource to get data from it.

(其中*是assocobjectarray等)

这篇关于通知是什么:资源ID#9?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆