douyakan8924 2017-07-17 19:20
浏览 75
已采纳

SQL查询没有正确提取数据

ID MAIL KEY                                                                                                                                  
1.7072E arnold.palmer@golf.com 48EF071156D86C05334D6E18A05E557129F51A6F10183AFAB14BD7581C58365D                                                                            
1.7071E arnold.dailey@golf.com 2445616C8C13B985ADE534B7550EA0938761BCBC7E99506E6F3D72275DA33FEC                                                                            

I have this table in my db. I use

SELECT ID, MAIL, KEY FROM Table WHERE MAIL='arnold.palmer@golf.com';

if($row = oci_fetch_array($parsed_sql, OCI_BOTH+OCI_RETURN_NULLS+OCI_RETURN_LOBS)) {
            $ID = $row['ID'];
            $key = $row['KEY'];                                   
            print($ID.' ->'.$key);

this print out 1.7072E -> $Eal�����4�U���a��~�Pno=r']�?�

Can anyone help me understand why I am getting that specific data over the hash that is in the database? I'm certain it is due to the data type being RAW, however when i try UTL_RAW.CAST_TO_VARCHAR2 It comes back undefined var.

  • 写回答

1条回答 默认 最新

  • dppx9253 2017-07-17 20:14
    关注

    Changing my SELECT statement to:

    SELECT ID, MAIL, RAWTOHEX(KEY) AS KEY FROM Table WHERE MAIL=:MAIL
    

    now gives me the proper hash output. The issue without Aliasing is why the variable was undefined.

    $key = $row['KEY'];
    

    without the alias PHP wasn't getting the right "field".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?