Very specific question, how can I make a select from a $_SESSION
that contains the first, middle and last name, only the first and last name?
Example:
The output from $_SESSION['NET']['USER']['NAME']
is 'Robert Pasha Biceps'
What I really need on a SELECT
is ALL that contains 'Robert Biceps'
$pdo = new \PDO('mysql:host=localhost;dbname=workflow_teste', 'root', '');
$pdo->setAttribute(\PDO::ATTR_ERRMODE , \PDO::ERRMODE_EXCEPTION);
$string = "SELECT * FROM foo WHERE fooname LIKE '".$_SESSION['NET']['USER']['NAME']."' ";
$statement = $pdo->prepare($string);
$statement->execute();
$result = $statement->fetchAll();
$statement->closeCursor();
echo '<pre>';
var_dump($result);
die;
The var_dump
only shows the results that have the entire name on it, but some people submit only the first and last name, and I need that results also...
Any ideas?