Like this:
class example {
public function func($query)
{
...
return $row;
}
}
How can i change below code:
public function func($query)
{
while($row=mysqli_fetch_assoc($query)){
return $row;
}
I tried to push every row to array but it is hard to get rows from array;
For example:
db.php
class db {
public function get($query){
while($row=mysqli_fetch_assoc($query)){
return $row;
}
}
show.php
$db = new db;
$row = $db->get("SELECT * FROM `posts`");
echo $row['title'];
echo "<br/>";
echo $row['body'];
This is what i want to do