Home >Backend Development >PHP Tutorial >如何修改代码达到以下结果

如何修改代码达到以下结果

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 14:18:56941browse

本帖最后由 lazygc520 于 2013-08-12 12:00:23 编辑

	$sql2 = "SELECT stock_no, cust_no, mount FROM `stock_detail` where stock_no = '".$stockno[$j-1]."' ORDER BY arr_time, adress, c_type ASC";	$result2 = mysql_query($sql2);	while($v2 = mysql_fetch_array($result2,MYSQL_ASSOC)) {		$v2[] = array_splice($a[$v2['stock_no']], 0, 13); 	$val_1 = implode(",",$v2['0']);	echo $val_1.'<br />';}


结果如下:
VP3.0 130219001,VP3.0 130219002,VP3.0 130219003,VP3.0 130219004,VP3.0 130219005,VP3.0 130219006,VP3.0 130219007,VP3.0 130219008,VP3.0 130219009,VP3.0 130219010,VP3.0 130219011,VP3.0 130219012,VP3.0 130219013<br />VP3.0 130219014,VP3.0 130219015,VP3.0 130219016,VP3.0 130219017,VP3.0 130219018,VP3.0 130219019,VP3.0 130219020,VP3.0 130219021,VP3.0 130219022,VP3.0 130219023,VP3.0 130219024,VP3.0 130219107,VP3.0 130219108<br />


如何变成:
'VP3.0 130219001','VP3.0 130219002','VP3.0 130219003','VP3.0 130219004','VP3.0 130219005','VP3.0 130219006','VP3.0 130219007','VP3.0 130219008','VP3.0 130219009','VP3.0 130219010','VP3.0 130219011','VP3.0 130219012','VP3.0 130219013'<br />'VP3.0 130219014','VP3.0 130219015','VP3.0 130219016','VP3.0 130219017','VP3.0 130219018','VP3.0 130219019','VP3.0 130219020','VP3.0 130219021','VP3.0 130219022','VP3.0 130219023','VP3.0 130219024','VP3.0 130219107','VP3.0 130219108'<br />


回复讨论(解决方案)

$val_1 = "'".implode("','",$v2['0'])."'";

$val_1 = "'".implode("','",$v2['0'])."'"; 

$val_1 = "'".implode("','",$v2['0'])."'"; 

感谢,原来还可以这么用。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn