Jump to content
StudioWeb Forums

Drew2

Member
  • Content Count

    26
  • Joined

  • Last visited

  • Days Won

    1

Drew2 last won the day on January 3

Drew2 had the most liked content!

Community Reputation

8 Good

About Drew2

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Yeah, I think it's all about constant practice - which can be tough given there are several coding languages. I've been told that young monks re-read holy texts tons of times in order to memorize them. So, perhaps taking this course once is good, but maybe not enough to reinforce everything to a master degree.
  2. Update: actually, this code doesn't quite do it. It does something else. So, I'd say the course could use some updating.
  3. Hello Jim, I understand your frustration. I was able to get through and understand the CRUD basics course. Yeah, 2 months is a pretty rough response time. I assume you've repeated the CRUD course a few times. If you haven't tried this already, I'd put your code in difchecker (https://www.diffchecker.com/) alongside the code you can download from the course. What I do is find a section that is probably giving trouble - it may be small. I'll copy the code I've written, and then copy the correct course code and paste it alongside one another. I tend to do this only af
  4. I like to use dif checker: https://www.diffchecker.com/ I copy a section of code that is correct (Ben's code), and then match it against what I have written. I tend to find errors that way.
  5. So here seems to be the stages leading up to $_SESSION['cart'] being set: First, someone clicks a link generated by m_products 'cart.php? id=' . $product['id'] Second, cart.php sees the product id in the url (generated by someone clicking the above link), and calls this function in m_cart.php to add a product: $Cart->add($_GET['id']); Third, m_cart.php starts this function: public function add($id, $num = 1) public function add($id, $num = 1) { //setup or retrieve cart $cart = array(); if(isset($_SESSION['cart'])) {
  6. Hello, Just want to voice a concern that no one is answering my questions anymore. I think I have put up around 5 questions - only a few have received responses. I'm a little surprised, as my questions aren't novels.
  7. Quick question: Why are there no periods bordering this php insertion? header("Location: $url"); I would expect it to look like this: header("Location: . $url . "); My guess, reading W3Schools and elsewhere is that both would amount to the same thing. I have to wonder though, it they amount to the same thing, why ever use the periods? -Seems like more work.
  8. Hello you wonderful coders you. I've been staring at this line of code (line 74 highlighted below) for a while in m_template.php, and want to share what it's doing. function getAlerts() { $data = ''; foreach($this->alertTypes as $alert) { if (isset($_SESSION[$alert])) { foreach($_SESSION[$alert] as $value) { $data .= '<li class="'. $alert .'">' . $value . '</li>'; } unset($_SESSION[$alert]);
  9. I'm on the PHP Logic with OOP section, and have what I think may be a pretty simple question. In v_login.php, where I see the login form, line 27 for example has this code: <input type="password" name="password" value="<?php echo $this->getData('input_pass'); ?>"> - This line of code takes the user input, and spits it into the form for the user to see. Then, in login.php, there is this code on line 30: $_SESSION['username'] = $Template->getData('input_user'); - this line of code adds to the $_SESSION variable. As v_login.php is included in login.php,
  10. Hello fellow coder fra168nk. I may have just figured out myself how include works. Imagine one document with the function of bouncing a ball. (D1) Then you have a second document with the request to actually bounce a ball (D2) For D2 to actually bounce a ball, it will need the help of D1. D1 is the tool with which D2 can bounce a ball. By writing, for example, include(D1) in D2, D2 now has access to the bouncing ball function in D1. D1 and D2 have become one document in a sense (in terms of one benefitting from the other). Although the documents are now one, in a
  11. Hello, I'm working through the login System using OOP in Stef's course. In the file m_template.php, there is this line of code: (Line 58) function setAlert($value, $type = null) { if ($type == '') { $type = $this->alertTypes[0]; } $_SESSION[$type][] = $value; } I'm trying to see how the highlighted section of code is working. Ben explains this, but I don't quite understand yet. First of all, I want to check that my concept of the session variable $_SESSION is correct: If I unpack a hypothetical $_SESSION variable, it could
  12. I am pouring over the "simple" php login system code for Ben Falk's tutorial. There is one line of code that I cannot make sense of. After reading several sources online about prepared statements, I *only* ever see them with parameters (e.g. ?). Yet, in Ben's tutorial, there is a prepared statement without parameters in file register.php: // create select options $select = '<option value="">Select an option</option>'; $stmt = $mysqli->prepare("SELECT id, name FROM permissions"); $stmt->execute(); $stmt->bind_result($id, $name); // for more i
×
×
  • Create New...