Jump to content

justsomeguy

Moderator
  • Content Count

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Everything posted by justsomeguy

  1. Wait, no, you've added $user_id to your function definition (which actually does give the function a purpose), but for some reason you've also decided to pass $user_id to mysqli_query, even though the third parameter to mysqli_query should be the result mode: https://www.php.net/manual/en/mysqli.query.php
  2. Yeah, that's literally the same code you posted 5 hours ago.
  3. Damn, did I call that, or what? You have decided that the problem with your code, after all of the questions that I asked, is that your code was missing curly brackets around the function call for some reason, even though you've never seen any other code that just has an arbitrary pair of curly brackets that are not associated with any control structure or anything else. I don't know what to say. Well done. The funny thing is that it's not actually a syntax error. It serves absolutely zero purpose at all, but yeah, if you want to just group arbitrary code in a set of bra
  4. OK, a few new questions: 1. Why are you defining the function with required parameters, and then not passing any parameters when you call it? 2. Since I already asked that, why didn't you address it? Did you not see the question? Did you ignore it? Do you not know what I'm talking about at all? 3. Why are those 2 lines of code in a function at all? What is the purpose of putting those 2 lines of code into a function? 4. Are you ever going to address the SQL syntax error? I've mentioned it multiple times and, again, it appears that you're just ignoring me when I point i
  5. Seriously. And why is the same character missing after the function definition line? There is a major lack of attention to detail going on, and that is a really bad sign for anyone who wants to program. This is the format of a function definition: function function_name (parameter list) { function body } You have this: { function function_name (parameter list) function body } And you don't seem to notice, or have any idea. That's worrisome.
  6. Well, I don't know what to tell you. Some books don't have enough information, other books have too much. I don't think the problem is the books. Of course not, now in addition to your SQL syntax errors, you have PHP syntax errors also.
  7. I wouldn't count on the filesystem returning data the way you want, I would get the list of all of the files and folders, sort them however you want to sort them, and print the sorted list.
  8. The example code isn't what you need, you need to start at the beginning. You need to understand variables, functions, constants, objects with methods and properties. You need to understand data types, string syntax, control structures, scope, and how to look up information in the manual. Any amount of looking at example code or Youtube videos will fail to give you that knowledge. That's just a fact. I would never expect a publishing company to provide technical support for their books. The people you are emailing are in the book publishing business, they don't have technical
  9. If you want to query multiple databases and group the results into a single result set, you need to use unions or subqueries to get the various results into a single set.
  10. The WHERE clause isn't the problem. You have both PHP syntax errors, and also SQL syntax errors, all in a single line of code. And those errors are there, and you don't see them, because you never bothered to understand the basics of what you're trying to use. I don't know if you've done much with electrical engineering, but I'll try to use an analogy. Imagine you're an electrical engineer, you've been designing circuits all of your life. You know how resistors, capacitors, etc work. You know the fundamentals, like the fact that a circuit has to be complete for any electricity to flo
  11. I don't know what you're asking. No code is "needed," it's up to you to decide what you want your program to do. Whether you put code in a function or not really only matters for reuse. And if you want to refer to a specific record in the database, you just need to know how to uniquely identify it. Most often that means passing an ID. If you're asking about mysqli_num_rows, if you read the description in the manual it says that it returns the number of rows in the result set. So if you're asking if you need to use that function, then I guess that depends whether you care how many row
  12. I'm not sure how to do it with one pattern, I don't use lookahead or lookbehind very often. I would use multiple patterns, but there's probably a way to do it with one.
  13. Every time you click search, you add a CSS file to the head. Get rid of that and see if it changes.
  14. You're telling it that you both need 2 digits and also that there can't be any digits. For your other pattern, I do get matches for those 2 strings.
  15. Use ^ at the start a character class to negate it. [^0-9] means any character other than a digit.
  16. Yeah if there's a lot of processing that needs to be done then it might be best to get all of the records and then process them with another language before outputting everything.
  17. I suppose you could write a query that would work by concatenating multiple rows, but that's only going to work if each row only has data in a single column. Otherwise, it's not the best design to store data like that.
  18. I'm not sure what you're describing, but of course you can only run code on your own server. No other site is going to allow you to run arbitrary server-side code on a server or site that isn't yours.
  19. Not that I can think of, in fact it won't even work to add more than one pattern when you're using positive lookahead, it will still only require 1 digit. You would need to test it with multiple expressions.
  20. Everything inside the else block there is what you want to happen on your site, so you would change that to match whatever your site is doing. That code shows adding everything to a table called mediumpathipn, and then updating the members table. You can replace that with whatever makes sense for your site. If the user ID that they pass you doesn't match the user IDs on your site then you need to have a way to map their user ID to your users.
  21. Make 2 patterns for 1 digit each instead of 1 pattern for 2 digits.
  22. If you want to save the data on the server then you need to use PHP to save it. If you want to count any arbitrary existing links then you could have Javascript send an ajax request to a PHP script with the URL that was clicked on, the URL of the current page, etc.
  23. I assume you just call getCurrentPosition again.
×
×
  • Create New...