Hi there, I am learning php mysql. Now I am trying to shwo a single row from a table by inserting id. That means i can read any row form table by inserting only id and that id contains other information like name , address will show with id. Please help....Thanks in advance.
select single row by id in php mysql
Collapse
X
-
you need to add limit 1 to ensure only 1 reccord is selected as there could be multiple rows against a single id$sql=mysql_quer y("select * from `yourtable` where id='theid'")or die(mysql_error ());
$row=mysql_fetc h_assoc($sql);
echo $row['name1'].$row['name2'].$row['name3'].$row['name4'];
Code:$sql=mysql_query("select * from `yourtable` where id='theid' LIMIT 1")or die(mysql_error()); $row=mysql_fetch_assoc($sql); echo $row['name1'].$row['name2'].$row['name3'].$row['name4'];Comment
Comment