Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by benanamen

  1. benanamen

    PHP picture name from sql not loading

    Right here @Barand echo '<img src="img/' . $row_product_image['name'] . '" class="w-100" />';
  2. benanamen

    PHP picture name from sql not loading

    This is true, except OP escaped the single-quoted strings so what he posted does in fact work.
  3. benanamen

    Undefined offset & error in your SQL syntax

    stripslashes on DB input? Are you really expecting your users to put slashes in the submitted data? That was typically a 90's DB output function back in the days when magic quotes was used. If you are learning from some tutorial now would be time to find a new one. I would highly suggest you start learning PDO. Here is a tutorial to get you going. https://phpdelusions.net/pdo
  4. benanamen

    issue with array_unique

    @ZackTim, post an SQL dump of your DB schema with a few sample records so we can see what your working with.
  5. benanamen

    Problem with quotation marks

    If you simply switched the double and single quotes around you wouldn't have to go through all the error prone escaping gymnastics. Open and close the echo with double quotes, then single quotes in all your elements.
  6. benanamen

    How to make simple if repeat in looping?

    Great, this is exactly what I was referring to as the real problem. Now we can decide what the correct approach should be, whether it is your approach or something else. I was not angry. We just need to know what is really going on to provide the best answers for you.
  7. benanamen

    How to make simple if repeat in looping?

    You don't seem to understand my question. You are asking how to solve your Attempted Solution to the Real problem. I want to know what the REAL problem is, not your approach to solving it. WHY are you doing this? Therein lies the REAL problem.
  8. benanamen

    How to make simple if repeat in looping?

    What is the actual (real) problem you are trying to solve with this code?
  9. benanamen

    Conversion of text data from $variables issue

    Instead of asking about your attempted solution to your problem, tell us what the real problem is you are trying to solve. You said you want to " use data from a MySQL query ". That sounds like that would be the real problem. Post the code you have tried to retrieve data from MySQL.
  10. benanamen

    Is there a proper way to set this up?

    The better method is to have a single point of entry, eliminating duplicate code and not using the XSS vulnerable $_SERVER['PHP_SELF']
  11. Unless this is just to learn the basics of file reading and writing do not store your data in a text file. At minimum use SQLite.
  12. benanamen

    Column / Row structure in php table

    This sure looks a lot like the lengthy thread already going on here https://www.sitepoint.com/community/t/addition-of-two-mysql-query-results/318019
  13. benanamen

    Best approach guidance

    Your asking about the most basics of HTML now. Your going to have to put in at least a little effort. Are you telling us you can create a database but you do not know how to make a form or what the syntax is for check boxes?
  14. benanamen

    Best approach guidance

    Your best option is to use PDO to work with the database. Here is a good tutorial to get you going. Forms are pretty basic so I wont get into how to create a form.
  15. benanamen

    Best approach guidance

    I would suggest you take this a step at a time. Start with the database. When you have the DB done, show us what you did and we will review it and guide you to any changes/improvements. After you implement the final DB design then we can move to the next step. You already have the overall summary of the project which was the first step. * Just a heads up. You would not have an "age" column. You would store the birth date and calculate the age from that.
  16. Your code smells of a bad database design. How about telling us why you are repeating the same data columns in multiple tables.
  17. benanamen

    Get specific MySQL/MariaDB error info

    I don't understand what you are looking for. What "content" do you want? Are you asking how to handle the error? If so, you can try/catch the error and respond the way you want. From the manual Source: http://php.net/manual/en/pdo.errorcode.php
  18. benanamen

    Get specific MySQL/MariaDB error info

    The error message could not be any more clear. You are attempting to insert/update/delete a column with a duplicate constraint with data that is already in the DB and incorrectly messing with data in a parent table that has child data.
  19. Could you please provide more information about this, as this is the "real" problem. You have been asking for help with your attempted solution to this. Let us decide what the solution should be. To properly do that we need to know all about the above.
  20. benanamen

    Insert Array values into mysql database

    When you when you start using incrementing numbers for your column names it is a big red flag to a design problem. Take a minute and learn about database normalization.
  21. benanamen

    Purchased Script - Help understanding file

    OP, you are incorrect. That is incorrect. It is the other way around .
  22. benanamen

    upgrade to PHP 5.5, Site Doesn't work

    That is not real code. Perhaps the manual will be of help. You will have to break it to your client that his "upgrade" is still hundreds and hundreds of releases behind. The whole bit of the code you posted shows there is quite a bit of work that will need to be done to bring the app up to date. Version 5.5 reached end of life many years ago. http://php.net/manual/en/mysqli.query.php
  23. benanamen

    Sql to loop through table

    The process can easily be automated. Allow me to introduce you to ETL, Extract, Transform, Load. There are many software's both free and paid for this purpose. https://en.wikipedia.org/wiki/Extract,_transform,_load
  24. For those of you that have not gotten the word, GitHub now offers FREE repository’s as of today.
  25. benanamen

    $row['index here'] outputs null

    Stop creating variables for nothing and use Prepared Statements. Never ever put user supplied variables in your query.

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.