Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Posts posted by justsomeguy

  1. You need to echo all of the HTML tags, right now the text you see there is the entire document.  So before you output those messages, you want to print the doctype, html tag, head tag maybe with a style block, body tag, maybe you want to wrap the messages in a div or span and put a class on it, etc.  Just like you're writing regular HTML.  You just use PHP to echo the HTML instead of just writing it in the file.  You can also close the PHP tag and just start writing HTML like at the bottom of the code.

  2. Which columns are selected inside the exists subquery is totally irrelevant, they aren't even used.  I always do SELECT * for those.  The only thing that matters is if a row was returned at all, the number or values of columns aren't even considered.

  3. How unique it is depends on what you've done to your computer.

    https://panopticlick.eff.org

    Using that, my browser happens to be unique among the ~300,000 or so they've tested.  A browser would not be unique if someone was using the default installation of IE/Edge on the most popular version of Windows.  They probably see a lot of those.  If any options which control web behavior are changed, or plugins are installed, or a bunch of fonts are installed, or any number of other things, it gets more and more unique.

    Is it as unique as uniqid() ?

    No, uniqid is supposed to be guaranteed to be unique (or, at least, it will take a long, long time before you get a collision).  The total number of values possible for uniqid is greater than the total number of possible browser configurations.

  4. Quote

    If I am honest, there is a lot there, and good some of it doesn't appeal to me, I'm going directly to what I need, and want. May be a rubbish way of learning this, but that is how I have gone about this.

    Yeah, it is.  You want to build a house.  But you really only like electrical, you're not really into framing and pouring concrete and plumbing and whatever else, that doesn't appeal to you.  So you just toss up some boards so you can do your wiring and electrical, and you're wondering why the roof keeps falling and you have no running water.  You don't want to actually learn how to frame the house, you just want someone to tell you how to keep the roof up.  It doesn't really work like that.

    Quote

    I then decided on example code, since it works, and I was going to take a long time to get anywhere, it hasn't worked out.

    That's because you don't understand why and how the code works.

    There is not a single person alive creating functional programs by themselves who does not understand why and how the code works.  You're trying to be the first.  It's not working out.

  5. You could use localStorage in Javascript to track people, or there are other client-side methods to do the same thing.

    Look into browser fingerprinting.  There is a lot of information exposed by the browser through Javascript which can be used to uniquely identify a particular computer.  That's one of the ways that something like Google Analytics would use to distinguish individual visits.

  6. But the code I got from the clips, if it works in them, why doesn't the example work for my system/host environment.

    You're literally not telling the code to do anything.  The code is "working" perfectly, it's doing exactly what you told it to do.  You just didn't tell it to do much other than define a function.

    I don't quite know where to go with this?

    Well, you need to understand functions, so pick up your book and read the chapter about functions.  If there are chapters before that one that you haven't read, then read those first.  If you pick up a novel and the first thing you read is chapter 9, then you peruse chapter 17, then read the last chapter, then watch a video of someone talking about what they thought of it, you may be able to have a shallow discussion about the book but you're not really going to understand what it's about.  This is no different.  You have no concept of the very basics of the language that you're trying to use and it should be blatantly obvious with how much time you've spent and how little you understand that your methods of learning are completely ineffectual.  You need to start at the beginning of the book and go from there.  If you finish a chapter and you don't really understand what you just read, read it again.  Repeat until you understand.

  7. It's just an old way to do it, the more modern way is to use addEventListener to attach handlers:

    https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener

    The tutorial shows using event attributes because it's the easiest to understand.

    In the case of using a load handler on the body, the common alternative is to just move the code that you would want to run after the body loads to the end of the body instead of using a load handler.

  8. That is remove.php When I click on this from the image link, only a blank screen then loads, so it doesn't work.

    It's doing exactly what you're telling it to do.  You include a file, then start the session, then define a function.  That's all you have it doing.  Perhaps next you want to actually run the function instead of only defining it.  Even if you did, the page would still be blank because you're not telling it to do anything that would write anything to the page.  So, it's doing exactly what you're telling it to do.  It's not going to read your mind and determine what you want to happen and do that, it's going to do exactly what you tell it to.  It's your job to figure out how to tell it to do what you want it to do.  If you want it to print something on the page, then tell it to do that.

  9. I really doubt you need Yet Another Video to tell you how to do this:

    DELETE FROM table WHERE field = 'value'

    Or, a soft delete:

    UPDATE table SET deleted = 1 WHERE field = 'value'

    It's just not a complex thing to do.

    Are you really still not sure how to delete something from the database?  Are you still stuck on that?  If you have questions about your code, you need to post your current code and the questions you have.

  10. Give the table an alias each time and use that to refer to the different fields so that things aren't ambiguous. e.g.:

    left join drivers AS d1 ON schedule.dropOffID = d1.driverID
    left join drivers AS d2 ON schedule.pickUpID = d2.driverID

    Use the same aliases in the select list to make sure you're selecting the correct columns.

    • Like 1
  11. If you want to do a soft delete then add a field to the database to say whether it is deleted, and change that to true when you delete something rather than actually deleting it.  When you get data from the database only get rows where the deleted field is false.  You can also store a timestamp of when it was deleted and run a script occasionally to delete records that are old enough.  I've never heard of people doing a delayed delete, but a soft delete is common.

×
×
  • Create New...