我正在使用php脚本将数据插入ms访问时的resource(3)类型(odbc结果) [英] resource(3) of type (odbc result) while i am inserting data to ms access using php script
本文介绍了我正在使用php脚本将数据插入ms访问时的resource(3)类型(odbc结果)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码是-
<?php
$test='C:\xampp\htdocs\cit\con1.mdb';
$connection = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$test", "", "");
$txtroll=$_REQUEST['txtroll'];
$all="face";
$sql="INSERT INTO inst (info,sname) VALUES ('$all','$txtroll')";
$rs = odbc_exec($connection, $sql);
var_dump($rs);
?>
我通过查询发送的数据未存储在数据库中.
The data I am sending through query is not getting stored in the database.
推荐答案
这里没有问题.您正在看到
There is no problem here. You are seeing
resource(3) of type (odbc result)
因为这是$rs
实际上是对象的类型(而var_dump
则告诉您).根据PHP文档,odbc_exec
...
because that's the type of object that $rs
actually is (and var_dump
is telling you that). According to the PHP documentation, odbc_exec
...
如果成功执行了SQL命令,则返回ODBC结果标识符;如果出错,则返回FALSE.
Returns an ODBC result identifier if the SQL command was executed successfully, or FALSE on error.
(参考:此处). $rs
不是FALSE
,因此INSERT没有遇到错误. (至少PHP对此一无所知...)
(ref: here). $rs
is not FALSE
, so the INSERT encountered no errors. (At least none that PHP knows about, anyway....)
这篇关于我正在使用php脚本将数据插入ms访问时的resource(3)类型(odbc结果)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文