我不能从MySQL数据库中获取多行到数组?我有代码,但它不工作或不显示所有行时,我回声到文本框?我不能从MySQL数据库获取多行到数组?
<?php
if(is_array($_SESSION['pid']))
{
$pid = join(',',$_SESSION['pid']);
$result=mysql_query("SELECT id AS wid FROM mywishlist where pid='$pid'")
or die("Id Problem"."<br/><br/>".mysql_error());
$results= array();
$i=0; // add the new line
while($row=mysql_fetch_array($result)){
$results[$i] = $row['wid'];
$i++;
}
$results;
}
$max=count($results);
for($j=0; $j<$max; $j++)
{
?>
<input type="text" name="wid[]" value="<?php echo $results[$j]; ?>" />
<?php } ?>
[**在新的代码,请不要使用'mysql_ *'功能**](http://bit.ly/ phpmsql)。他们不再被维护[并被正式弃用](https://wiki.php.net/rfc/mysql_deprecation)。看到[**红框**](http://j.mp/Te9zIL)?学习[*准备的语句*](http://j.mp/T9hLWi),并使用[PDO](http://php.net/pdo)或[MySQLi](http://php.net/ mysqli) - [这篇文章](http://j.mp/QEx8IB)将帮助你决定哪个。如果你选择PDO,[这里是一个很好的教程](http://www.brightmeup.info/article.php?a_id=2)。 – 2013-03-18 09:54:18
为sql注入好的洞好运 – 2013-03-18 09:54:51
为什么'结果;'后虽然lop – 2013-03-18 09:55:00