php - get values from select query and put them into variables -
i'm beginner in php , mysql, want know how can put values got select query variables.
for example used mysql query :
$req="select type, titre, auteur, abstract, keywords manusrit file='$name';"; $req1=mysql_query($req);
i want put value of column type in $type
variable , value of auteur in variable called $auteur
, same abstract, , keywords.
how can this?
first of use pdo instead of mysqli. example :
$link = mysql_pconnect($hostname, $username, $password) or die('could not connect'); //echo 'connected successfully'; mysql_select_db($dbname, $link); $name = $_post['name']; $query ="select type, titre, auteur, abstract, keywords manusrit file='$name';"; mysql_query("set names 'utf8'", $link); $result = mysql_query($query, $link); //now fetch result , read 1 one while ($row = mysql_fetch_assoc($result)) { //access colmn print $row['abstract']; print $row['keywords']; }
Comments
Post a Comment