php - force a pointer to reset on postgres result array -


i attempting make calendar salesman of sort of clients have lined week.

there table have stores each lined client entry.

i have sql statement scoops , trying layout looks like:

monday | tuesday | wednesday | thursday | friday 

and want dump entries divs under each of columns in table.

the sql data not grouped day, return like:

array("monday","joe blow"); // index 0 array("monday","sally smith"); // index 1 

and on.

i have placed right after result retrieve statement:

while ($row = pg_fetch_array($result,null,pgsql_assoc) {  } 

and iterates through each row.

however happens when need dump more 1 row under single column?

i thinking code along line of:

while ($row = pg_fetch_array($result,null,pgsql_assoc)) {      while ($row['day']=="monday") {        echo '<div>'.$row['client_name'].'</div>';     }      while ($row['day']=="tuesday") {        echo '<div>'.$row['client_name'].'</div>';     }  } 

however didn't go anywhere seems return true everytime hits "thursday" because pointer hasn't reset on original while loop fetch next record.

i trying figure out clean way set pointer next record , start again @ original while loop.

anybody got idea on this??

thanks million!

i found it!

the function use pg_result_seek() covered in here

thank rjdown!


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -