Jump to content

Barand

Moderators
  • Posts

    24,566
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. You do it in the same way you have in your get_post($pid) function, only this time pass the category id get_posts($cat_id)
  2. I'd start by sorting them by date so I know the oldest.
  3. You can't put functions inside strings like variables. <?php $x = date('Y'); $y = 1989; $description = "In this classic lecture which was delivered over " . ($x - $y) . " years ago, etc etc....."; echo $description; // ==> In this classic lecture which was delivered over 31 years ago, etc etc..... ?>
  4. Have you tried putting a WHERE clause in your query, for example WHERE blog.cat_id = 4
  5. Welcome.
  6. According to that information in your comment, the records don't have a "status_id" Why the exit();
  7. Instead of outputting the the HTML for a table with rows, you output the HTML for the cards instead.
  8. Since previous post
  9. Just ran a speedcheck while I'm reading this...
  10. Don't know if this is connected but recently I have been working with another Invision-powered site. When connected to either taht site or Freaks site (even if the tab is not current tab) my broadband upload speed is crippled, sometimes dropping below 1Mbps. Both these sites repeatedly have the same effect and I have not seen it happen on any other sites. Prior to connection Connected to https://www.foxestalk.co.uk or Freaks On closing the Invision tab the speed returns to normal. It seems the Invision software permanently hogs the line.
  11. This is your query in a more readable form select DISTINCT , login.username , login.login_time , players.Player_ID , players.Player_name , players.Player_First_Name , Players.Player_Last_Name , players.player_email INNER JOIN players on login.username=players.Player_ID where login.login_time > ‘2019-09-09’ It is missing "FROM login" where I left the empty line before "INNER JOIN". Your date needs to be inside plain single quotes (not the single inverted quotes that your editor has used). Are you sure you want to be joining a username with an id (usually numeric)? If none of those help, show us the error message your are getting.
  12. .. or JSON as an alternative was also proposed. Both are suitable for products with different attribute sets. Possibly - that's usual bandaid to resort to when you've spread data over several tables instead of one. Try it and see. Experimentation is a wonderful technique.
  13. The point is, they are crap bad variable names if you want anyone else to understand how to relate your code to the problem you so poorly described. If you are storing the data as a comma separated lists, you need to normalize your data. Good luck;
  14. Your fist post talked about users, goals and tasks. Your second is all about visits and routes. Have you moved on to another problem somewhere inbetween and haven't told us?
  15. Perhaps this answer I gave you a year ago might help
  16. You would also need to know if, and when, the share was sold.
  17. To see if you have any mysql errors, put this line immediately before the line calling mysql_connect() mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); EDIT: and where is $myout defined?
  18. I have re-structured your code for you, adding a list of contacts so you can see if they are added. <?php $servername = "localhost"; $username = "admin"; $password = "1234"; $dbname = "test"; $conn = new PDO("mysql:host=$servername;dbname=$dbname;charset=utf8", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); ## ## Has data been posted? ## if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (trim($_POST['name']) != '') { // use prepared statement $stmt = $conn->prepare("INSERT INTO contacts (name) VALUES (?)"); $stmt->execute( [ $_POST['name'] ] ); } // reload page header("Location: #"); exit; } ## ## Create contacts check list ## $res = $conn->query("select id , name from contacts order by id "); $list = ''; foreach ($res as $row) { $list .= "<tr><td>" . join ('</td><td>', $row) . "</td></tr>\n"; } ?> <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <!-- Bootstrap core CSS --> <link href="css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" type"text/css" href="css/style.css"> <script src="http://cdn.ckeditor.com/4.6.1/standard/ckeditor.js"></script> </head> <body> <div class="modal fade" id="addContact" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <form method="post"> <!-- .....content with all the inputs --> <input type="text" name = "name" value="" class="form-control" placeholder="Name of contact..."> <button type="submit" class="btn btn-primary">Save to database</button> </form> </div> <hr> <h3>Contacts Check List</h3> <table style='width: 400px;'> <tr><td>ID</td><td>Name</td></tr> <?=$list?> </table> </body> </html>
  19. https://lmgtfy.com/?q=html+meta+refresh
  20. A meta-refresh will do what you want <?php echo "Your pizza is ready<br>"; echo "<meta http-equiv=\"refresh\" content=\"5; url='url-to-go-to'\" />" ?>
  21. Don't hijack other people's topics Try Google
  22. One problem you have is that you cannot correctly compare date values in m/d/Y format. To compare reliably they need to be Y-m-d. 08/01/2020 > 02/01/2021 whereas 2021-01-02 > 2020-01-08 - correct
  23. RTFM https://www.php.net/manual/en/language.operators.assignment.php https://www.php.net/manual/en/language.operators.comparison.php
  24. Why have you got three tables with the same apparent structure instead of a single table with an extra column to indicate paye/contract/permanent?
  25. If it did it was only by luck. The information returned for each id could come from any of the records with that id, not necessarily the one with the max value.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.