I'm a newbie,
I have made a database with data about members ( id,name,email, ... ) with MYSQL. I have made a table in html with some data about ALL the members. Now i'm trying to make another page with the data but FOR ONLY A SINGLE MEMBER.
In other words, I want to show only a particular line in my database. I have copied some codes of my singlemember.php page in progress. Maybe i can adapt from there or i must start from scratch, you tell me.
Last question, how should I write my hyperlinks so it can activate my singlemember.php page but with the data of my line 1
( id=1 ) ? Something like .../singlemember.php?id=1
<?php
//1
include "template.inc";
//2
$db = mysql_connect('HOST','USER','PASSWORD');
mysql_select_db('DATABASE',$db);
$sql = 'SELECT id,name,rank,email FROM tablename_tbl';
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
//3
$tpl = new template("gabarits");
$tpl->set_file("gliste","singlemember.html");
//4
$tpl->set_block('gliste','liste_clients','liste_bloc');
//5
while($data = mysql_fetch_array($req)) {
//6
$tpl->set_var("id", $data['id']);
$tpl->set_var("perso", $data['name']);
$tpl->set_var("rang", $data['rank']);
$tpl->set_var("email", $data['email']);
//7
$tpl->parse('liste_bloc','liste_clients',true);
}
//8
mysql_close();
//9
$tpl->pparse("affichage","gliste");
?>
Thanks for your help