Welcome to WebmasterWorld Guest from 54.92.197.82

Forum Moderators: open

Message Too Old, No Replies

Matching A Long String With PDO

match a long string with pdo

     
1:19 am on Jun 10, 2017 (gmt 0)

Junior Member from US 

5+ Year Member

joined:Feb 11, 2010
posts:130
votes: 2


I can't get my statement to match a variable that comes through an email link. The same variable goes into a mysql column but I can't get the two of them to match(that is, "Doesn't Exist"). I've searched the internet and forums and have come up with no answers.

$mailcode = $_GET["mailcode"];
$count=$dbo->prepare("select * from table where mysqlcode=:mailcode");
$count->bindParam(":mailcode",$mailcode,PDO::PARAM_STR,85);
if($count->execute()){
$row = $count->fetch(PDO::FETCH_LAZY);
if($row){
echo"Exists";
}else{
echo"Doesn't Exist";}
}else{
print_r($dbo->errorInfo());
}
2:31 am on June 10, 2017 (gmt 0)

Junior Member from US 

5+ Year Member

joined:Feb 11, 2010
posts:130
votes: 2


For what its worth: the reason for the long string is part of a password reset script. It is in the link as well as the database.
3:32 pm on June 11, 2017 (gmt 0)

Junior Member from US 

5+ Year Member

joined:Feb 11, 2010
posts: 130
votes: 2


Found the problem. The string was actually made up of 18 separate mini random strings and 17 time codings, it was a very unique code right down to the second. I copied the code out of the database and found a blank space about half way but was not showing in the string on the link in the email. Re-wrote the coding out for the variable and all is fine now though I'm still not sure what caused the gap. I'll look into that another time.