Home Backend Development PHP Tutorial php获得sybase数据库内容的有关问题

php获得sybase数据库内容的有关问题

Jun 13, 2016 am 11:45 AM
date echo nbsp sql sybase

php获得sybase数据库内容的问题
数据库连接已经测试过了没问题,sql语句也没问题。现在问题是获取不到数据库里的数据,代码如下:

public static function Connect()<br /> {<br /> $obj =new DB();<br /> $conn=$obj->Connection=sybase_connect(SERVER_NAME, USER, PASSWORD) ; // 连接数据库<br /> if(!$conn){<br /> echo '数据库连接错误...';<br /> exit(0);<br /> }<br /> sybase_select_db(DATABASE_NAME);<br />     return $obj;  <br /> }<br /> //初始化页面时查询最近一个月的销售记录<br /> public function QueryLastMonth(){<br /> $start_date=str_replace('-','',date('Y-m-d',strtotime('-1 month')));<br /> $end_date=str_replace('-','',date('Y-m-d',time()));<br /> $sql_str="select cusno as shopcode,u2.nos as salesid,u2.colthno as goodsid,u2.endprice as price,u2.nb as goodscount from u2sale u1,u2saleb u2 where u1.outdate>=";<br />$sql=$sql_str ."'".$start_date."' and u1.outdate<='".$end_date."' and u1.nos=u2.nos and u1.nb>0 and u2.endprice>0;";<br /><br />  //echo $sql;<br /> // sybase_query("set rowcount " . 20) ; // 执行SQL命令,设置返回记录行数<br />   $result = sybase_query($sql) ; // 执行SQL命令,检索数据库<br />   echo "---".$result;<br />   while($row = sybase_fetch_assoc($result)) <br />   { <br />  // echo 'xxx';<br />   echo $row["shopcode"] . "---" . $row["salesid"] . "---" . $row["goodscount"] . "\n" ;<br />    }<br />	<br />	sybase_close($conn);<br /> }
Copy after login

请指教

Statement of this Website
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Solution: Your organization requires you to change your PIN Solution: Your organization requires you to change your PIN Oct 04, 2023 pm 05:45 PM

Solution: Your organization requires you to change your PIN

How to adjust window border settings on Windows 11: Change color and size How to adjust window border settings on Windows 11: Change color and size Sep 22, 2023 am 11:37 AM

How to adjust window border settings on Windows 11: Change color and size

How to enable or disable taskbar thumbnail previews on Windows 11 How to enable or disable taskbar thumbnail previews on Windows 11 Sep 15, 2023 pm 03:57 PM

How to enable or disable taskbar thumbnail previews on Windows 11

What is the difference between HQL and SQL in Hibernate framework? What is the difference between HQL and SQL in Hibernate framework? Apr 17, 2024 pm 02:57 PM

What is the difference between HQL and SQL in Hibernate framework?

Display scaling guide on Windows 11 Display scaling guide on Windows 11 Sep 19, 2023 pm 06:45 PM

Display scaling guide on Windows 11

10 Ways to Adjust Brightness on Windows 11 10 Ways to Adjust Brightness on Windows 11 Dec 18, 2023 pm 02:21 PM

10 Ways to Adjust Brightness on Windows 11

How to turn off private browsing authentication for iPhone in Safari? How to turn off private browsing authentication for iPhone in Safari? Nov 29, 2023 pm 11:21 PM

How to turn off private browsing authentication for iPhone in Safari?

Usage of division operation in Oracle SQL Usage of division operation in Oracle SQL Mar 10, 2024 pm 03:06 PM

Usage of division operation in Oracle SQL

See all articles