Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


benanamen last won the day on October 28 2019

benanamen had the most liked content!

Community Reputation

115 Excellent


About benanamen

  • Rank
    Master Coder

Contact Methods

  • Website URL
  • Yahoo

Profile Information

  • Gender
    Not Telling
  • Interests
    Email me at phpfreaks@galaxyinternet.us

Recent Profile Visitors

5,002 profile views
  1. OMG! I could care less about your code dude! I was just trying to help you. Good luck getting assistance with that attitude.
  2. Hi @NotionCommotion, long time no chat. This is all interesting stuff. I was just wondering, are you actually having a problem to where this matters or is this just for learning?
  3. Tell you what, if you can provide a zip of your files I will review it and tell you what is wrong.
  4. In that case, just remove the session start from your include files. You should have no need to check if a session has been started.
  5. I'm sorry, I assumed you wanted to learn how to do things better. My bad.
  6. The better approach is to have a single point of entry to the site/application. Then as mentioned, you set the session once in the main file. Here is a free video series tutorial on Php by the Laravel Laracast guy. Even I, after more than 30 years of programming learned several new things. https://laracasts.com/series/php-for-beginners
  7. Sure you could but you are going to need code gymnastics to cover every possible case. Not really optimum IMO. The "extra data input" is a one time insert and you are done with it. At that point, it is as simple as selecting the column in your query.
  8. Based on the site link I would say what you are looking for is a "short name" for the schools. I would add a column to the DB to hold that data. So you have columns city, school_full_name, school_short_name
  9. That makes no sense at all. If you are displaying the data from the school name column why would it not be what the school is named?
  10. IMO, you are just creating a problem mixing data. It doesn't matter if the school name is the same as the city. A city is a city, a school is a school.
  11. Thanks @Psycho. Shows how much I knew about Factorials, lol.
  12. This is a real thing how the brain works. It has to do with how the prefrontal cortex works. I have solved many a problem by not trying to solve the problem and stepping away from it. Without trying, you get that A-ha moment and the answer comes to you.
  13. A function also known as a method when in a Class should do one thing and do it well. It should also be easily re-usable and not have to be edited to use it elsewhere. What you have is none of that. What you will probably discover as the first problem is that you have hard coded the groups which means if you want a group other than uk you now have a problem on your hands. Duplicating the function for every group is not the answer. What you want to do is pass the groups value to the function as a parameter. Now you can use the same function for any group. Same thing goes for the hard-coded table name. There is also no option to specify specific columns. Again you would run into problems with the hard coded column headers and every other hard coded item. Here is something you get you going towards a dynamic solution. (It's not a cut n paste solution) <?php declare(strict_types=1); $sql = 'YOUR-QUERY-HERE'; $stmt = $db->pdoQuery($sql); $row = $stmt->fetch(PDO::FETCH_ASSOC); if (!$row) { echo '<H1>No Records Available</H1>'; } else { $data = []; foreach ($row as $key => $val) { $data[ucwords(str_replace('_', ' ', $key))] = $val; } ?> <div class="table-responsive"> <table id="myDataTable" class="table table-bordered table-striped table-hover table-sm"> <thead class="thead-dark"> <tr> <th><?= join('</th><th>', array_keys($data)) . "</th>\n" ?> </tr> </thead> <tbody class="searchable"> <?php do { echo "<tr>\n<td>" . join("</td>\n<td>", $row) . "</td>\n"; echo " </tr> \n"; } while ($row = $stmt->fetch(PDO::FETCH_ASSOC)); ?> </tbody> </table> </div> <?php }
  • 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.