I was trying to pullout the content of all the functions defined from the class segment in segment.php. And calling all the three functions from a class segment in home_segment.php Is this a correct way of calling multiple functions from one class.
segment.php
<?php
$mysqli = mysqli_connect("localhost","root","","square");
$cid = required_param('id', PARAM_INT);
class segment
{
public function unitseg_set1($cid)
{
$subject = $mysqli->query('SELECT * FROM order_subject WHERE id='.$cid.'');
while($row=$subject->fetch_array() )
{
echo '<div>'.$row['chem_name'].'</div>';
}
}
public function unitseg_set2($cid)
{
$subject = $mysqli->query('SELECT * FROM order_subject WHERE id='.$cid.'');
while($row=$subject->fetch_array() )
{
echo '<div>'.$row['physiotherapy_nn'].'</div>';
}
}
public function unitseg_set3($cid)
{
$subject = $mysqli->query('SELECT * FROM order_subject WHERE id='.$cid.'');
while($row=$subject->fetch_array() )
{
echo '<div>'.$row['commun_gg'].'</div>';
}
}
}
?>
home_segment.php
<?php
require_once('segment.php');
$account1 = segment::unitseg_set1($cid);
$account2 = segment::unitseg_set2($cid);
$account3 = segment::unitseg_set3($cid);
echo $account1.$account2.$account3;
?>