search
HomeBackend DevelopmentPHP TutorialODBC function of php3_PHP tutorial
ODBC function of php3_PHP tutorialJul 13, 2016 pm 05:25 PM
connectodbcone timefunctionenumerateNowuseof

Now let's list the commonly used ODBC functions in PHP3:

odbc_connect (dns, user, pass);
Returns a connection number, or 0 if the connection fails.

odbc_pconnect (dns,user,pass);
Special connection, the connection will not be disconnected after the script is finished running. The second time connecting to the same DNS is faster.

odbc_commit (connection number);
Interrupt the thread executing the connection, return True if successful, and False if failed.

odbc_autocommit (connection number, 0/1);
When the parameter is 1, set all threads executing the connection to automatically interrupt.

odbc_do/odbc_exec (connection number, sql statement);
Execute the sql statement and return a result number. If the operation fails, false is returned.

odbc_prepare (connection number, sql statement);
Returns a result number, but does not execute the sql statement. You can use odbc_execute (the result number) to execute later.

odbc_fetch_into (result number, [number of records,] array);
Put a certain record of the result (omitted to the next record) into the array (starting from [0]), regardless of the number of the array type.
Returns the position of the record in the result, or returns false if the operation fails.

odbc_fetch_row (result number, [number of records]);
Move to a certain record (omitted to the next record), which can be read and written by odbc_result.

odbc_num_fields (result number);
Returns the total number of fields.

odbc_num_rows (result number);
Returns the total number of records.

odbc_result (result number, field number/field name);
Returns the field number/field name in the current record in the result.

odbc_result_all (result number, sql statement);
Return all query results and output them in html table.

odbc_field_name/odbc_field_type/odbc_field_len (result number, field number);


Returns the field name/data type/data length of the field.

odbc_lonreaglen (result number, length);
Set the field length of the returned result. If the length is 0, all will be returned.

odbc_free_result (result number);
Release memory when the query results in memory are not needed.

odbc_cursor (result number);
Returns a pointer pointing to the result.

odbc_rollback
odbc_close (connection number);
Close the connection.

odbc_close_all();
Close all connections.



A specific example of using PHP3 to manipulate ODBC database.

db is the dsn name of odbc, tab1 is the table name



echo "ODBC Samples"."
";
$Connection_ID=odbc_connect(" db","","");
$Result_ID=odbc_exec($Connection_ID,"Select * from tab1");
$i=1;
$fldCount=odbc_num_fields($Result_ID);
echo "";
while (odbc_fetch_row($Result_ID,$i)0)
{
echo " ";
for ($j=1;$j{
echo " ".$i." ";
echo " ".odbc_result($Result_ID,$j)." ";
}
echo "
";
 $i=$i+1;
}
echo " ";
?>




In fact, the query process It can also be simplified to:
$Connection_ID=odbc_connect("db","","");
$Result_ID=odbc_exec($Connection_ID,"Select * from tab1");
$fldCount=odbc_num_fields ($Result_ID);
odbc_result_all($Result_ID);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532090.htmlTechArticleNow we will list the commonly used ODBC functions in PHP3: odbc_connect (dns, user, pass); Returns a connection number, or 0 if the connection fails. odbc_pconnect (dns,user,pass); Special connection...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
如何在技嘉主板上设置键盘启动功能 (技嘉主板启用键盘开机方式)如何在技嘉主板上设置键盘启动功能 (技嘉主板启用键盘开机方式)Dec 31, 2023 pm 05:15 PM

技嘉的主板怎么设置键盘开机首先,要支持键盘开机,一定是PS2键盘!!设置步骤如下:第一步:开机按Del或者F2进入bios,到bios的Advanced(高级)模式普通主板默认进入主板的EZ(简易)模式,需要按F7切换到高级模式,ROG系列主板默认进入bios的高级模式(我们用简体中文来示范)第二步:选择到——【高级】——【高级电源管理(APM)】第三步:找到选项【由PS2键盘唤醒】第四步:这个选项默认是Disabled(关闭)的,下拉之后可以看到三种不同的设置选择,分别是按【空格键】开机、按组

CS玩家的首选:推荐的电脑配置CS玩家的首选:推荐的电脑配置Jan 02, 2024 pm 04:26 PM

1.处理器在选择电脑配置时,处理器是至关重要的组件之一。对于玩CS这样的游戏来说,处理器的性能直接影响游戏的流畅度和反应速度。推荐选择IntelCorei5或i7系列的处理器,因为它们具有强大的多核处理能力和高频率,可以轻松应对CS的高要求。2.显卡显卡是游戏性能的重要因素之一。对于射击游戏如CS而言,显卡的性能直接影响游戏画面的清晰度和流畅度。建议选择NVIDIAGeForceGTX系列或AMDRadeonRX系列的显卡,它们具备出色的图形处理能力和高帧率输出,能够提供更好的游戏体验3.内存电

广联达软件电脑配置推荐;广联达软件对电脑的配置要求广联达软件电脑配置推荐;广联达软件对电脑的配置要求Jan 01, 2024 pm 12:52 PM

广联达软件是一家专注于建筑信息化领域的软件公司,其产品被广泛应用于建筑设计、施工、运营等各个环节。由于广联达软件功能复杂、数据量大,对电脑的配置要求较高。本文将从多个方面详细阐述广联达软件的电脑配置推荐,以帮助读者选择适合的电脑配置处理器广联达软件在进行建筑设计、模拟等操作时,需要进行大量的数据计算和处理,因此对处理器的要求较高。推荐选择多核心、高主频的处理器,如英特尔i7系列或AMDRyzen系列。这些处理器具有较强的计算能力和多线程处理能力,能够更好地满足广联达软件的需求。内存内存是影响计算

主板上的数字音频输出接口-SPDIF OUT主板上的数字音频输出接口-SPDIF OUTJan 14, 2024 pm 04:42 PM

主板上SPDIFOUT连接线序最近我遇到了一个问题,就是关于电线的接线顺序。我上网查了一下,有些资料说1、2、4对应的是out、+5V、接地;而另一些资料则说1、2、4对应的是out、接地、+5V。最好的办法是查看你的主板说明书,如果找不到说明书,你可以使用万用表进行测量。首先找到接地,然后就可以确定其他的接线顺序了。主板vdg怎么接线连接主板的VDG接线时,您需要将VGA连接线的一端插入显示器的VGA接口,另一端插入电脑的显卡VGA接口。请注意,不要将其插入主板的VGA接口。完成连接后,您可以

提高 Python 代码可读性的五个基本技巧提高 Python 代码可读性的五个基本技巧Apr 12, 2023 pm 08:58 PM

Python 中有许多方法可以帮助我们理解代码的内部工作原理,良好的编程习惯,可以使我们的工作事半功倍!例如,我们最终可能会得到看起来很像下图中的代码。虽然不是最糟糕的,但是,我们需要扩展一些事情,例如:load_las_file 函数中的 f 和 d 代表什么?为什么我们要在 clay 函数中检查结果?这些函数需要什么类型?Floats? DataFrames?在本文中,我们将着重讨论如何通过文档、提示输入和正确的变量名称来提高应用程序/脚本的可读性的五个基本技巧。1. Comments我们可

CRPS:贝叶斯机器学习模型的评分函数CRPS:贝叶斯机器学习模型的评分函数Apr 12, 2023 am 11:07 AM

连续分级概率评分(Continuous Ranked Probability Score, CRPS)或“连续概率排位分数”是一个函数或统计量,可以将分布预测与真实值进行比较。机器学习工作流程的一个重要部分是模型评估。这个过程本身可以被认为是常识:将数据分成训练集和测试集,在训练集上训练模型,并使用评分函数评估其在测试集上的性能。评分函数(或度量)是将真实值及其预测映射到一个单一且可比较的值 [1]。例如,对于连续预测可以使用 RMSE、MAE、MAPE 或 R 平方等评分函数。如果预测不是逐点

Linux怎么安装ODBC连接SQLServer数据库Linux怎么安装ODBC连接SQLServer数据库May 16, 2023 pm 12:19 PM

操作系统:Centos7.21、下载ODBC安装包unixODBC-2.3.9.tar.gzfreetds-1.3.9.tar.gz2、安装步骤第一步:上传两个安装包到服务器上第二步:安装unixODBC,先安装这个,后安装freetds注意:这里如果安装顺序不一致,就不会产生libtdsodbc.so驱动文件(非常重要)2.1、操作系统先安装gcc:yuminstallgcc2.2、安装odbctar-xvfunixODBC-2.3.9.tar.gzcdunixODBC-2.3.9./conf

详解JavaScript函数如何实现可变参数?(总结分享)详解JavaScript函数如何实现可变参数?(总结分享)Aug 04, 2022 pm 02:35 PM

js是弱类型语言,不能像C#那样使用param关键字来声明形参是一个可变参数。那么js中,如何实现这种可变参数呢?下面本篇文章就来聊聊JavaScript函数可变参数的实现方法,希望对大家有所帮助!

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor