i can't get multiple rows into array from mysql database? i have code but it is not working or not showing all rows when i echo into textbox?
<?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_*functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.$results;after while loppid IN ($pid), but yes, injection is a problem here.