razorsese Posted April 25, 2012 Share Posted April 25, 2012 I'm having trouble of getting the code right When i try to dump the $x value it's appearing null; class Dictionary{ var $id=null; var $en=null; var $sp=null; var $type=null; public function __construct($data=array()) { if( isset($data['id']) ) $this->id= (int)$data['id']; if( isset($data['en']) ) $this->en= $data['en']; if( isset($data['sp']) ) $this->sp= $data['sp']; if( isset($data['type']) ) $this->type= $data['type']; } public function store ( $params ) { // Store all the parameters $this->__construct( $params ); } public function WordGet($word)//add the english and spanish word { $con = new PDO(DBN,DB_USER,DB_PASS); $sql = "SELECT *FROM word WHERE MATCH(en) AGAINST ('ctx')"; $st = $con->prepare($sql); $st->bindValue(':word',$word,PDO::PARAM_STR); $st->execute(); $r = $st->fetch(); $con = null; return new Dictionary($r); } $test = new Dictionary; $x = $test->WordGet('ctx'); var_dump($x); Quote Link to comment https://forums.phpfreaks.com/topic/261587-php-pdo-match-against/ Share on other sites More sharing options...
Jessica Posted April 25, 2012 Share Posted April 25, 2012 $sql = "SELECT *FROM word WHERE MATCH(en) AGAINST ('ctx')"; $st = $con->prepare($sql); $st->bindValue(':word',$word,PDO::PARAM_STR); $st->execute(); Will this even work since your query string does not contain :word anywhere? Do you have error reporting on? Quote Link to comment https://forums.phpfreaks.com/topic/261587-php-pdo-match-against/#findComment-1340456 Share on other sites More sharing options...
razorsese Posted April 25, 2012 Author Share Posted April 25, 2012 Yes i have error_reporting(-1) And i tried whit the :word removed and still nothing Quote Link to comment https://forums.phpfreaks.com/topic/261587-php-pdo-match-against/#findComment-1340458 Share on other sites More sharing options...
razorsese Posted April 25, 2012 Author Share Posted April 25, 2012 It was from the innoDB Quote Link to comment https://forums.phpfreaks.com/topic/261587-php-pdo-match-against/#findComment-1340463 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.