[Solved] PDO states I am missing tokens, But I am not – what’s wrong with this [closed]

You are setting the query before you add the filter to the query string. // Get the results from the query $query->setQuery($sqlSelect) ->setParameter(‘startMonth’, $startMonth) ->setParameter(‘endMonth’, $endMonth); if (!empty($filter)) { $sqlSelect .= ‘AND LOG.VALUE LIKE :filter ‘; $query->setParameter(‘filter’, ‘%’.$filter.’%’); } You are setting the query to $sqlSelect and aftwards appending the filter part after setting the … Read more

[Solved] How to show all arrays without numbers etc

This is nothing related to PDO. You might wanna do this: for ($i = 0; $i < count($tijdlijn); $i++) print_r ($tijdlijn[$i][‘bericht’]); Or in a better way: foreach ($tijdlijn as $tijd) print_r ($tijd[‘bericht’]); 0 solved How to show all arrays without numbers etc

[Solved] PDOException SQLSTATE[HY000] [2002] No such file or directory

The error message indicates that a MySQL connection via socket is tried (which is not supported). In the context of Laravel (artisan), you probably want to use a different / the correct environment. Eg: php artisan migrate –env=production (or whatever environment). See here. 5 solved PDOException SQLSTATE[HY000] [2002] No such file or directory

[Solved] SQL INSERT VALUES INTO TABLE FROM FILE [closed]

Both your PHP and your MySQL syntax have problems. First, your SQL statement needs to be surrounded by quotes. Secondly, the syntax for LOAD DATA INFILE is incorrect. Try this: $stmt=$db->prepare(“LOAD DATA INFILE ‘insert.txt’ into table `Info`”); $stmt->execute(); See the MySQL docs for LOAD DATA INFILE for more options. You’ll probably need to specify your … Read more

[Solved] Cant solve this : Invalid parameter number: number of bound variables does not match [closed]

Missing Comma (,) in this line. Due to which bound variables were not matching. $req = $pdo->prepare(“INSERT INTO t_events_changes …. Values (… :new_standby_start:old_standby_end, … )”); ^ here missing comma Change it to, :new_standby_start,:old_standby_end, 2 solved Cant solve this : Invalid parameter number: number of bound variables does not match [closed]

[Solved] Fatal error: Uncaught exception ‘Exception’ with message ‘id not supplied’

throw new Exception(“id not supplied”); This line throws the exception that causes the fatal error you’re seeing. It’s run under this condition: if(!isset($id)){ So obviously, the condition matches, which means that the $id variable is not set. Also, extract($_REQUEST) is extremely bad practice. Simple scope example: function foo($a) { $a = 5; echo $a; //5 … Read more

[Solved] fetchAll helper function using PDO

edit: as the Colonel indicated, apparently this (no longer?) works with LIMIT clauses. If you’re using simple queries / are not that bothered with type: function fetchAll(){ $args = func_get_args(); $query = array_shift($args);//’SELECT * FROM users WHERE status=? LIMIT ?,?’ //you’ll need a reference to your PDO instance $pdo somewhere…. $stmt = $pdo->prepare($query); $stmt->execute($args); return … Read more