Advertisement
Guest User

arrays implode

a guest
May 19th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <title>array</title>
  5. </head>
  6. <body>
  7. <?php
  8. $sql_select = "SELECT * FROM cart";
  9. $run_select = mysqli_query($con,$sql_select);
  10. $datas = array();
  11. if (mysqli_num_rows($run_select) > 0) {
  12.  
  13. while ($show = mysqli_fetch_assoc($run_select)) {
  14.  
  15.   $id[] = $show;
  16.  }
  17. }
  18.  
  19. //print_r($datas);
  20.  /*echo "cid";
  21. foreach ($datas as $id) {
  22.   echo $id['cid'].",";
  23. }
  24.  
  25. echo "<br/> p_id";
  26. foreach ($datas as $p_id) {
  27.   echo $p_id['p_id'].",";
  28. }
  29. echo "<br/> ip_add";
  30. foreach ($datas as $ip_add) {
  31.   echo $ip_add['ip_add'].",";
  32. }
  33.  
  34. echo "<br/>  quantity";
  35. foreach ($datas as $qty) {
  36.   echo $qty['qty'].",";
  37. }
  38. */
  39. $avengers = implode(",", $id['1']);
  40.  
  41. echo $avengers;
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement