Coded Firstimage Coded Firstimage - 5 months ago 17
MySQL Question

I wana to get all in mysql

I want fetch all rows in mysql column but it return only 1 is have try this out while($info=mysql_fetch_all($query2, mysql_assoc))
{
but not working please help me out

Answer

Quick fix is to replace mysql_fetch_all to mysql_fetch_assoc:

$query2=mysql_query("SELECT * FROM websitee 
  WHERE poster='$_SESSION[user_name]' 
  ORDER BY id DESC LIMIT $offset, $rowsperpage"); 
$num=mysql_num_rows($query2); 
if($num==0) { 
  echo"<div class='msg'>No topics yet</div>"; 
} else { 
  echo"<br/><br/><div align='center' class='b_head'><strong>HOTTEST UPDATES</strong></div><div class='center'><span class='style18'></span></div><br><br> ";
  while($info=mysql_fetch_assoc ($query2)) { 
    $id=$info["id"]; $ftp=$info["ftp"]; $server=$info["server"];
    $password=$info["password"]; 
    print_r($info);
  }
} 

But you should stop using mysql_* functions and use mysqli or pdo.

Comments