dounaidu0204 2016-09-26 08:49
浏览 53
已采纳

期望参数1是资源,布尔给定,查询使用前1个顺序通过desc [duplicate]

i still new in sqlserver and i trying to fetch database like this

$sql = "select top 1 pdate from j2365join_transaction_old where order by pdate desc";
$mulaisql = sqlsrv_query($sqlconn2, $sql, array(), array( "Scrollable" => 'static'));
$mulai = sqlsrv_fetch_array ($mulaisql, SQLSRV_FETCH_ASSOC);
print_r ($mulai);

but go error

sqlsrv_fetch_array() expects parameter 1 to be resource, boolean given

, can someone explain to me why i got this error, thanks

</div>
  • 写回答

1条回答 默认 最新

  • dongyao2022 2016-09-26 08:52
    关注

    Error in your query my friend.

    $sql = "select top 1 pdate from j2365join_transaction_old where order by pdate desc";
    

    You should write condition after where clause. If there is no WHERE condition then please remove WHERE clause. So your query will we right

    $sql = 'select "top 1 pdate" from j2365join_transaction_old  order by pdate desc';
    

    Generally you should not use spaces in column, although you have done then you can read it by using

    Quote ("field name")

    Large brackets

    "[field name]"

    With backticks

    SELECT * FROM `Area One`
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100