3个回答
展开全部
给你写了段代码.主读取在get_data函数中.
<?php
define("HOST", "localhost");
define("DB", "demo");
define("DBUSER", "root");
define("DBPASSWD", "mysql");
$local_conn = mysql_connect(HOST,DBUSER,DBPASSWD);
if(!isset($local_conn)) exit();
mysql_select_db(DB);
$sql = "set names utf8";
mysql_query($sql,$local_conn);
function get_data($conn,$name){
$sql = "select * from t_demo where time like'".$name."'";
$resultRows = @mysql_query($sql,$conn);
while($trow = @mysql_fetch_array($resultRows)){
$result[] = $trow;
}
mysql_free_result($resultRows);
return $result;
}
$result = get_data($local_conn,"test");
?>
<?php
define("HOST", "localhost");
define("DB", "demo");
define("DBUSER", "root");
define("DBPASSWD", "mysql");
$local_conn = mysql_connect(HOST,DBUSER,DBPASSWD);
if(!isset($local_conn)) exit();
mysql_select_db(DB);
$sql = "set names utf8";
mysql_query($sql,$local_conn);
function get_data($conn,$name){
$sql = "select * from t_demo where time like'".$name."'";
$resultRows = @mysql_query($sql,$conn);
while($trow = @mysql_fetch_array($resultRows)){
$result[] = $trow;
}
mysql_free_result($resultRows);
return $result;
}
$result = get_data($local_conn,"test");
?>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
StringBuffer是可变长的数组,循环取值赋值就可了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
循环赋值就得了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询