Hi there, I need to create several records in my mysql+php application, I decided to build them from scratch, because some people told me that the performance is better. So, before starting to fight with the code, I made a pseudocode, please let me know what you think about it and make me suggestions about improve it or change it.
report 1: print employees grouped by countrys areas (occidental, central, oriental)
$sql="select a.name, a.age, b.salary, b.couarea from employees as A inner join details as b on a.id=b=id order by b.couarea";
$rs=mysqli_query($conn, $sql);
$x=$rs[ 'couarea' ];
$a=mysql_num_rows($rs);
for($i=1, i<=$a, i++ ){
if($x=$rs[ 'couarea' ] ){
echo "<tr><td>" . $rs[ 'name' ] . "</td><td>". $rs[ 'salary' ] . "</td></tr>";
}
else{ //the value of the current record is different
$x=$rs[ 'couarea' ];
}
}
all right, my main questions are:
1. the idea of the pseudocode is good?
2. the use in this case of the "mysql_num_rows" command is apropiate?
3. is there a command for skip between records?
thanks a lot