Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by benanamen

  1. I mean dump the $data variable. There is nothing there to loop over. var_dump($data);
  2. Additionally, you need to access the file through a server, not the filesystem. If your URL starts like file:/// you are not using a server.
  3. It should be noted that trimming $_POST with array_map as shown will fail on multi-dimensional arrays. A simple function will solve the problem. function trim_array($input) { if (!is_array($input)) { return trim($input); } return array_map('trim_array', $input); } $_POST = [ ["data1 ", " data2", " data3 "], ["data4", " data5", " data6 "]]; $post = trim_array($_POST); var_dump($post);
  4. Any decent editor or IDE will do it for you.
  5. mysql_* has been completely removed from current versions of Php. You need to use PDO with Prepared statements. This tutorial will get you going. https://phpdelusions.net/pdo
  6. I knew this conversation sounded familiar......... https://www.phphelp.com/t/terminology-discourse/33277/5
  7. Sounds to me like you have an Architecture problem. You "should" be serving all your files through a single point of entry. You might want to start a new thread about that topic with details of how you have things set up.
  8. Where does $url magically come from?
  9. You need to use Prepared Statements and your problem will be solved. NEVER EVER put variables in your query and NEVER EVER trust user supplied data. But as to why the problem, there are no quotes in your $_POST values. You have $_POST[article_id] instead of $_POST['article_id']
  10. Yes, stop using shared hosting and get a VPS.
  11. As far as file names, what DOES make a difference is underscore and dash to separate words. As simple search proves this out. On google search fast_cars and see returned result count, then try fast-cars. I get 13,000,000 results and 1,600,000,000 respectively Bottom line, use dashes as the separator.
  12. Take a look at my clean-pdo code repo. https://github.com/benanamen/clean-pdo
  13. Your code is vulnerable to an SQL Injection Attack. You need to use Prepared Statements. NEVER EVER PUT VARIABLES IN YOUR QUERY
  14. The form data is in the POST array which you do nothing with. Besides that, this code will be vulnerable to an Email Header Injection Attack if it were to work.
  15. Oh, so your a Domain Squatter. 🚩🚩
  16. The break tag (br) by no means goes anywhere within a Select element. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
  17. How about giving us a high level overview of what you have going on and the real problem you are trying to solve by doing this.
  18. You might want to tell us exactly what that error is. We cant see your screen and you posted incomplete code. What you did post is wide open to an SQL Injection Attack. You need to use Prepared Statements.
  19. When you are done, post a sql dump of your db tables and we will review it for you.
  20. Here's what I would suggest.. Back up your DB and Code-base Clean up your orphans Add the Foreign Keys Learn and implement cascading update/delete Clean up the unnecessary code You have been doing it "your way" long enough that the difference and time/effort savings will be very apparent. In a nutshell, but some fresh eyes on it and just try it. There really isn't much more to say about it. * I am assuming your DB is already normalized. If not, now is the time to fix it.
  21. Sounds like someone hasn't set unique indexes on the relevant DB columns.
  22. Sure, if you can tell me why the obsession with resetting the auto-increment. I will go first to save a post.... #1 reason to use Foreign Keys is to enforce Data Integrity. You can try and manage it yourself but if you get it wrong you will end up with orphan records (Bad Data). Wouldn't surprise me at all if you already have orphans. As soon as you try to set the FK's you will know right away if you do. It also clearly defines the links between tables (That would be the R in RDMS, Relational, AKA Relationships) Then you didn't learn how to do it. It is not complicated and is a great feature, especially when multiple table record deletes are involved at the same time. The more tables involved, the more code needed and the more chance of something breaking. You also unnecessarily increase your technical debt. Another thing, if anyone, including your future self does a reverse engineer data model it is instantly clear how data is related to other data. It is not up to me to talk you into anything. I am not the one that has to work with your DB. There are right/better ways to do things and Foreign Keys in an RDMS is one of them.
  23. Navicat saves query's within itself as part of the program. Based on the additional info you provided, there is no reason whatsoever to reset the auto-increment. And as I already said, once you start creating a real relational DB with keys you wont be able to do it anyways. If you actually want to be able to call a "saved" query at will from the DB will you will need a stored procedure or run the saved query in Navicat which actually is a "saved" query.
  24. Well, there is an hour of my life I am never getting back. Why do I even bother?
  • 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.