R0xxy Posted May 7, 2014 Share Posted May 7, 2014 Hi I working on a register page with prepared statements but i'm having an issue detective why I am receiving this error, could anyone suggest solutions I'm fairly new to this code Parse error: syntax error, unexpected T_DOUBLE_ARROW $stmt = $db->prepare("SELECT email FROM login WHERE email=:email1 LIMIT 1"); $arr = $array( 'email'=>$email); ArrayBinder($stmt, $arr); try{ $stmt->execute(); } catch(PDOException $e){ echo errorHandle($e); } while($row = $stmt->fetch(PDO::Fetch_ASSOC)){ print_r($row); } Quote Link to comment https://forums.phpfreaks.com/topic/288309-error-within-array-double-arrow/ Share on other sites More sharing options...
maxxd Posted May 7, 2014 Share Posted May 7, 2014 What does ArrayBinder() look like? Everything looks ok (please use the code tags in the future - they make your code much easier to read) at first glance. Usually the error message will give you a line number and file name. That'll help you pin down where the actual problem is happening. Quote Link to comment https://forums.phpfreaks.com/topic/288309-error-within-array-double-arrow/#findComment-1478554 Share on other sites More sharing options...
R0xxy Posted May 7, 2014 Author Share Posted May 7, 2014 function ArrayBinder (&$pdoStatement, &$array){ foreach($array as $k=>$v){ $pdoStatement->bindValue(':'.$k,$v); } hi the error like is where it says 'email'=>$email); Quote Link to comment https://forums.phpfreaks.com/topic/288309-error-within-array-double-arrow/#findComment-1478556 Share on other sites More sharing options...
Solution maxxd Posted May 7, 2014 Solution Share Posted May 7, 2014 Ah - remove the '$' in front of the array() keyword. In other words, instead of $arr = $array('email'=>$email); use $arr = array('email'=>$email); Quote Link to comment https://forums.phpfreaks.com/topic/288309-error-within-array-double-arrow/#findComment-1478558 Share on other sites More sharing options...
R0xxy Posted May 7, 2014 Author Share Posted May 7, 2014 thanks it worked Quote Link to comment https://forums.phpfreaks.com/topic/288309-error-within-array-double-arrow/#findComment-1478559 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.