how can i take a column from the database?
mysql_fetch_array returns my rows but I want the colunms, for example :
$bilgi= mysql_query("SELECT age,wname,slid,sex,c_name FROM user ");
//echo mysql_errno($con).":".mysql_error($c开发者_StackOverflow中文版on)."\n";
while($sutun= mysql_fetch_array($bilgi))
{
echo $sutun["age"]." ";
echo $sutun["wname"]." ";
echo $sutun["sex"]." ";
echo $sutun["slid"]." ";
echo $sutun["c_name"]."\n";
}
this return me rows i want it to return colonms any idea?
$bilgi= mysql_query("SELECT age,wname,slid,sex,c_name FROM user LIMIT 1");
Would only return one row, but I don't think this is what you want? You need a primary key and use that in a WHERE clause to identify the row you need.
$bilgi= mysql_query("SELECT age,wname,slid,sex,c_name FROM user WHERE id=1");
id
being the primary key to identify a row.
精彩评论