Wednesday, 14 February 2018

html - How to get data from database and echo on php page?

How to get the date from database and echo on PHP page?




$query = $pdo->prepare('SELECT * FROM shop WHERE shopname=:shopname');
$query->bindParam(':shopname', $shopname, PDO::PARAM_STR);
$query->execute();

$result = $query->fetchAll(PDO::FETCH_ASSOC);
echo "$result['shopid']";


This gives me the following error:





Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE),
expecting identifier (T_STRING) or variable (T_VARIABLE) or number
(T_NUM_STRING)


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...