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