PHP数组键值对获取键和值

29. October 2016 PHP 0

include_once ‘Database.php’;
$sql=”select * from vote”;
// $sql=”show columes from vote”;
$result=mysql_query($sql,$conn);
$row=mysql_fetch_assoc($result);
$key=array_keys($row); //返回所有键名

$value=array_values($row);

array_keys($array,”lijian”); 返回值为lijian的键名
//print_r($key);
?>


Leave a Reply

Your email address will not be published. Required fields are marked *