In order to achieve different outputs. I would like to use prepared statements so the Select where query will output different records depending on the value of Tags. Since I have just switched to PDO, I am unsure on how to do this.
I have looked into tutorials such as http://php.net/manual/en/pdo.prepared-statements.php but this shows fixed values to the prepared statments and not values i can change by entering a different URL.
Current code:
<?php
$pdo=new PDO("mysql:dbname=createyo_TestDatabase;host=localhost","createyo_james","password");
$statement=$pdo->prepare("SELECT * FROM Articles where Tags = ?");
$statement->execute(array($tag));
$results=$statement->fetchAll(PDO::FETCH_ASSOC);
$json=json_encode($results);
print $json;
?>