douxingmou4533 2018-06-28 08:51
浏览 66

MySQL上的SELECT不适用于我的PHP脚本,但使用phpmyadmin

I have a MySQL table with a VARBINARY 257 to store crypted passwords. I have to update records regularly. Before to make a REPLACE INTO, I would like to make a SELECT with all the values I have. If I find a record, REPLACE is not necessary. It's because I have a timestamp column with an "on update CURRENT_TIMESTAMP" attribute to store last modification time. It works well when there's no password, but even if all values are the same, SELECT doesn't work. If I use same SELECT on phpmyadmin, it works. I have a function to read records in which I've tried mysqli functions and PDO class :

mysqli :

function getMySQL($query, $pwd) {
    $link = mysqli_connect("localhost", "decisionrule", $pwd, "gateways");
    if (mysqli_connect_errno())
        return array(array('Connection error : '.mysqli_connect_error()));
    $result = mysqli_query($link, $query);
    $res = array();
    for ($i=0; $row = mysqli_fetch_array($result, MYSQLI_ASSOC); $i++)
        $res[$i] = $row;
    mysqli_free_result($result);
    mysqli_close($link);
    return $res;
}

PDO :

function getMySQL($query, $pwd) {
    try {
        $bdd = new PDO('mysql:host=localhost;dbname=gateways', "decisionrule", $pwd);
    }
    catch(Exception $e) {
        die('Erreur : '.$e->getMessage()."
");
    }
    $res = array();
    $response = $bdd->query($query);
    while ($donnees = $response->fetch())
        $res[] = $donnees;
    $response->closeCursor();
    return $res;
}

Returns an empty array for my issue.

Example of a SELECT :

SELECT name FROM partenaires WHERE gateway='GTWEIR01' AND name='ACCOLADE' AND proto_ident='ACCOLADE' AND protocol='SFTP' AND comments='ACCOLADE - SA0000026603841' AND login_ident='cofidisacco' AND login_password=0x014f4593f6e4360b4c4905da27e3a912e9e8f641ca96557ef1a7e7c10f44273d56c661107d1983d47a9f822e2e419c295b791dd4aed54fe57a4bcd44130f475c4673ec14d044ce208e84bd6a447161874746567e5446388883bbe3a3b8ddb75155488e8290fc5850cfcd776edf9994819e85d1fcec8b4ba3e02c2081a440172b AND dest_address='90.83.11.173/22' AND org_address='' AND dest_address_1='41.87.153.85/22' AND org_address_1='' AND dest_address_2='' AND org_address_2='' AND dest_address_3='' AND org_address_3=''

Is there a size limit for SELECT that can be changed because it works on phpmyadmin ?

Versions :

RedHat 6
PHP 5.3.3
Apache 2.2.15
MySQL 5.1.73

Thanks

  • 写回答

1条回答 默认 最新

  • douao3636 2018-06-28 11:08
    关注

    I've searched a long time, more than one whole day, without finding out what was wrong. And it was so simple. I'm using RSA public key to crypt password and, even if password hasn't be changed, crypting has each time another result. So my SELECT can't be successfull.

    I must apologize for wasting your precious time.

    Special thanks to Shadow and Leet Hudka.

    评论

报告相同问题?

悬赏问题

  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计