php - i can't get multiple rows into array from mysql database? -


i can't multiple rows array mysql database? have code not working or not showing rows when echo textbox?

<?php  if(is_array($_session['pid'])) {   $pid = join(',',$_session['pid']);    $result=mysql_query("select id wid mywishlist pid='$pid'")              or die("id    problem"."<br/><br/>".mysql_error());   $results= array();   $i=0; // add 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 } ?> 

the line join(',',$_session['pid']) makes me think want select multiple rows pid. try make use of in operator:

select id wid mywishlist pid in ($pid) 

Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -