mysql - Loading page with a single record from a list of records. [PHP] -
i'm complete beginner using mysql database , php
i'm looking load single record page list of records clicking link.
i've got list of records working , when link clicked takes user page url:
/view.php?v=1 (with 1 being id of record clicked on menu)
how load relevant record (the 1 '1' id) on page? seems simple can't find how anywhere.
obviously need use sql statement content database need put? like:
$sql = "select * topics topicid=v";
use url's
variable $_get
$topic_id = $_get['v'];
you can pass parameters in query rather dumping variable:
$query = $pdo->prepare(select * topics topicid=:topic_id); $query->bindvalue(':topic_id', $topic_id);
this document guide more. http://php.net/manual/en/ref.pdo-mysql.php
Comments
Post a Comment