Jump to content

Barand

Moderators
  • Content Count

    21,006
  • Joined

  • Last visited

  • Days Won

    511

Everything posted by Barand

  1. If you are starting with this (which could be the result from a table subquery) ... +----+----------------------+------------+-----------------+----------+ | id | disciplina | moduloUfcd | idcpDisciplinas | anoTurma | +----+----------------------+------------+-----------------+----------+ | 58 | Comunicação Visual | 8599 | 49 | 11 | | 59 | Comunicação Visual | 133 | 49 | 11 | | 60 | Comunicação Visual | 134 | 49 | 10 | +----+----------------------+------------+-----------------+----------+ then this query ... SELECT group_concat(id separator ', ') as ids , disciplina , group_concat(moduloUfcd separator ', ') as mods , idcpDisciplinas , anoTurma FROM gmc GROUP BY idcpDisciplinas, anoTurma; gives ... +--------+----------------------+-----------+-----------------+----------+ | ids | disciplina | mods | idcpDisciplinas | anoTurma | +--------+----------------------+-----------+-----------------+----------+ | 60 | Comunicação Visual | 134 | 49 | 10 | | 58, 59 | Comunicação Visual | 8599, 133 | 49 | 11 | +--------+----------------------+-----------+-----------------+----------+
  2. Also note that the above code does not put the lastname into the $result variable.
  3. Seems to me that the best approach would be to fix the problem instead of disabling the warning.
  4. 1 ) You don't need the mysql_real_escape_string. That is for strings (the clue is in the name). $cat_id is an int. 2 ) The mysql_xxxx functions are obsolete. If you ever get around to upgrading you version of PHP to someting less than 5 years old, they won't work. Switch to using PDO class.
  5. Not knowing what data you have, I'm going to guess that is correct. Now do the same in your php code.
  6. If $cat_id contains "" then the query will fail with a syntax error. But we don't know what's in it, nor do we know what's in your table - and we certainly have no idea what "don't work" means unless you tell us. Check if your query gave an error message.
  7. 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)
  8. 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..... ?>
  9. Have you tried putting a WHERE clause in your query, for example WHERE blog.cat_id = 4
  10. According to that information in your comment, the records don't have a "status_id" Why the exit();
  11. Instead of outputting the the HTML for a table with rows, you output the HTML for the cards instead.
  12. Just ran a speedcheck while I'm reading this...
  13. 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.
  14. 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.
  15. .. 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.
  16. 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;
  17. 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?
  18. Perhaps this answer I gave you a year ago might help
  19. 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?
  20. 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>
  21. https://lmgtfy.com/?q=html+meta+refresh
×
×
  • 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.