Advertisement
Guest User

CodePHP-PDO

a guest
Aug 8th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. $sortBy = $_GET['sortBy'];
  2. $color = $_GET['color'];
  3. echo $sortBy;
  4. echo $color;
  5. $i = 0;
  6. if ($color != '')
  7. {
  8. if ($sortBy != '')
  9. {
  10. $items = $con -> prepare("SELECT * FROM item_descr WHERE color_base1 = :colorbase1 SORT BY $sortBy");
  11. $items = bindParam(':colorbase1', $color, PDO::PARAM_STR);
  12. }
  13. else
  14. {
  15. $items = $con -> prepare("SELECT * FROM item_descr WHERE color_base1 = :colorbase1");
  16. $items = bindValue(':colorbase1', $color);
  17. }
  18. }
  19. else
  20. {
  21. if ($sortBy != '')
  22. {
  23. $items = $con -> prepare("SELECT * FROM item_descr ORDER BY $sortBy ASC");
  24. }
  25.  
  26. else
  27. {
  28. $items = $con -> prepare("SELECT * FROM item_descr ORDER BY date DESC");
  29. }
  30. }
  31.  
  32. $row_count = 0;
  33. $items ->execute();
  34. while($info = $items->fetch(PDO::FETCH_ASSOC))
  35. {
  36. echo "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement