在PHP中使用Access的Jet / Sql [英] Jet/Sql with Access in PHP
本文介绍了在PHP中使用Access的Jet / Sql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用PHP连接到.accdb,主键,INDI_ID是一个整数。语句$ sql =SELECT * FROM Table1 WHERE FullName ='ABNER AVERY'返回正确的数据。但是,声明$ sql =SELECT * FROM Table1 WHERE INDI_ID = 108并不返回任何内容。我需要用任何东西封装数字吗?
I'm using PHP to connect to an .accdb, the primary key, INDI_ID is an integer. The statement $sql="SELECT * FROM Table1 WHERE FullName ='ABNER AVERY'" returns the proper data. However, the statement, $sql="SELECT * FROM Table1 WHERE INDI_ID = 108" does not return anything. Do I need to encapsulate the number with anything?
$conn=odbc_connect('genealogy','','');//dsn
$sql="SELECT * FROM Table1 WHERE INDI_ID = 108";
//
//FullName ='ABNER AVERY'
//=#27-Sep-50# finds dates equal to 27 September 1950
$result=odbc_exec($conn,$sql);echo odbc_error($conn);
if (odbc_fetch_row($result))
{
$assoc=array();
while($user_detail = odbc_fetch_array($result) ) {
$assoc = array_push_assoc($assoc, 'INDI_ID', $user_detail["INDI_ID"]);
$assoc = array_push_assoc($assoc, 'Given', $user_detail["Given"]);
推荐答案
sql =SELECT * FROM Table1 WHERE FullName ='ABNER AVERY'返回正确的数据。但是,语句
sql="SELECT * FROM Table1 WHERE FullName ='ABNER AVERY'" returns the proper data. However, the statement,
sql =SELECT * FROM Table1 WHERE INDI_ID = 108不返回任何内容。我需要用任何东西封装数字吗?
sql="SELECT * FROM Table1 WHERE INDI_ID = 108" does not return anything. Do I need to encapsulate the number with anything?
conn = odbc_connect(< span class =code-string>' genealogy',' ',' '); // dsn
conn=odbc_connect('genealogy','','');//dsn
这篇关于在PHP中使用Access的Jet / Sql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文