PHP/MySQL-获取行数据
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP/MySQL-获取行数据相关的知识,希望对你有一定的参考价值。
Use this function to pull all columns from a single database field.getrowdata(tablename,rowid,prefix);
You would call this function like:
getrowdata("users",$_SESSION['user'],"user_");
The prefix is the prefix you want for the array names, so if I have a field in my "users" table called "username", the example above would output the variable "$user_username = 'data';"
function getrowdata($tablename,$rowid,$prefix){ //Get field data foreach($field_array as $field_key=>$field_value){ //Setup a global variable name for this data based on prefix global ${"{$prefix}$field_key"}; } } }
以上是关于PHP/MySQL-获取行数据的主要内容,如果未能解决你的问题,请参考以下文章