Advertisement
oquidave

results array

Jul 20th, 2011
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. global $broadcast;
  2. $lists_arr = ViewList();
  3. $table = '<table border>';
  4. $table .= "<th>List Name</th><th>Actions</th>";
  5. foreach ($lists_arr as $key => $value) {
  6. switch ($key) {
  7. case 'listname':
  8. $list_name = $lists_arr['listname'];
  9. $table .= "<tr>
  10. <td>$list_name</td><td>Edit</td><td>Delete</td>
  11. </tr>";
  12. break;
  13.  
  14. }
  15.  
  16. }//close foreach stmt
  17. //close table
  18. $table .= "</table>";
  19. echo $table;
  20.  
  21. function ViewList() {
  22. /*
  23. * Create a list for this user
  24. */
  25. //db handler
  26. DbHandler();
  27. $query= "select * from $schema.$tb;";
  28. $result = pg_query($query);
  29. if ($result) {
  30. //return results array
  31. $res_arr = pg_fetch_array($result);
  32. return $res_arr;
  33. } else {
  34. $message = "Failed to select list";
  35. $code = 102;
  36. throw new Exception($message, $code);
  37. }
  38. }//close ViewList() fn
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement