Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 26th, 2012  |  syntax: None  |  size: 2.30 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Query is sorting properly but is not showing all results properly
  2. //Unseen
  3. $variis = "Need Help";
  4. $myid = "This is the user's id;"
  5.  
  6. $sql = "select car_help.car_id, agent_names.agent_name, help_box.status,
  7. car_help.why_car, car_help.date_time_added, car_help.just_date,
  8. car_help.type, agent_names.agent_id
  9. from car_help LEFT JOIN agent_names on car_help.agent_whois = agent_names.agent_id
  10. where agent_names.system_id = '$myid' and car_help.system_id='$myid'
  11. and added_by <> '$myid' and help_box.status = '$variis'
  12. UNION
  13. select magazine_help.note_id, agent_names.agent_name, help_box.status,
  14. magazine_help.note_name, magazine_help.date_time_added,
  15. magazine_help.just_date, magazine_help.type, agent_names.agent_id
  16. from magazine_help LEFT JOIN agent_names on
  17. magazine_help.agent_id = agent_names.agent_id
  18. where agent_names.system_id='$myid' and
  19. magazine_help.system_id = '$myid' and added_by <> '$myid'
  20. and help_box.status = '$variis'
  21. UNION
  22. select motorcycle_help.rand_id, agent_names.agent_name,
  23. help_box.status, motorcycle_help.rand_name, motorcycle_help.date_time_added,    
  24. motorcycle_help.just_date, motorcycle_help.type, agent_names.agent_id
  25. from motorcycle_help LEFT JOIN agent_names ON
  26. motorcycle_help.by_who = agent_names.agent_id
  27. where agent_names.system_id = '$myid' and
  28. motorcycle_help.system_id='$myid' and added_by <> '$myid'
  29. and help_box.status = '$variis'
  30. UNION
  31. select mobile_questions.bal_test_id, agent_names.agent_name,
  32. help_box.status, mobile_questions.bal_why, mobile_questions.date_time_added,  
  33. mobile_questions.just_date, mobile_questions.type, agent_names.agent_id
  34. from mobile_questions LEFT JOIN agent_names ON
  35. mobile_questions.agent_who_ordered = agent_names.agent_id
  36. where agent_names.system_id = '$myid' and
  37. mobile_questions.system_id='$myid' and added_by <> '$myid'
  38. and help_box.status = '$variis'
  39. ORDER BY date_time_added DESC LIMIT $startrow, 20";
  40.  
  41. $result = mysql_query($sql);
  42.  
  43. $query = mysql_query($sql) or die ("Error: ".mysql_error());
  44.  
  45.  
  46. if ($result == "")
  47. {
  48. echo "";
  49. }
  50. echo "";
  51.  
  52.  
  53. $rows = mysql_num_rows($result);
  54.  
  55. if($rows == 0)
  56. {
  57. print("");
  58.  
  59. }
  60. elseif($rows > 0)
  61. {
  62. while($row = mysql_fetch_array($query))
  63. {
  64.  
  65. $row1 = $row['row_name'];
  66.  
  67.  
  68. print("$row1");
  69. }
  70.  
  71. }
  72.        
  73. where agent_names.system_id = '$myid' and
  74. motorcycle_help.system_id='$myid' and added_by <> '$myid'
  75. and help_box.status = '$variis'