Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by benanamen

  1. benanamen

    pattern help

    Every time I have seen the use of UNION on the forums it ALWAYS involved bad database design. You might want to post your DB Schema for us to review. One thing that doesn't get talked about much is the use of database views. A view allows you to simplify complex queries among a few other benefits.
  2. benanamen


    Help you with what? Help you code it? Help you hire somebody to code it? Help you to find out where you can buy it? Feel free to ask an actual question.
  3. benanamen

    Why If Not Statement Fetch Condition Fails ?

    Depending on what forum you are on and how many times he was banned from it or how many duplicate accounts he signed up will determine which of the at least 10 usernames the OP goes by. It would make a heck of a switch statement if you were to program it out.
  4. benanamen

    Echo variable that gets generate LATER

    Like @requinix said but.... <?php function foo($day_of_week){ echo "A lucky day for you is $day_of_week"; } ob_start(); $day_of_week = 'Tuesday'; foo($day_of_week); $output = ob_get_clean(); echo $output; Same thing can be done like <?php function foo($day_of_week){ return "A lucky day for you is $day_of_week"; } $day_of_week = 'Tuesday'; $output = foo($day_of_week); echo $output; But really though, what is the REAL problem you need to solve?
  5. benanamen

    Echo variable that gets generate LATER

    And you think you will? If something doesn't exist how do possibly expect to output it?
  6. benanamen

    Encryption? Salt? Secret Key? Whaaat?

    I am going to jump back in here. You learned something very important when posting to forums and that is, asking how to solve your problem, not how to solve your attempted solution. Your OP (Original Post) is known as an XY Problem. The description is in my signature. I will also refer you to this page on "How to ask Questions the Smart Way". It provides a lot of helpful detailed info.
  7. benanamen

    Encryption? Salt? Secret Key? Whaaat?

    md5 ? decrypting passwords? Whaaat? Just toss this code right now and learn how to use password_hash and password_verify like the rest of us.
  8. benanamen

    Insert Query Inside foreach Loop ...

    Are you able to post an SQL dump of your current DB schema with a few sample records? You can also PM it. It would be very helpful to see what you are actually working with.
  9. benanamen

    Insert Query Inside foreach Loop ...

    I don't quite get whats going on here yet but something smells really bad. OP, how about focus on what the real problem is that needs to be solved rather than talking about your attempt at solving it. Sure smells like an XY problem and as the forum members here know, I have a very sensitive nose for it.
  10. benanamen

    Php Sql INSERT not inserting a new value on the data table

    Your real problem is that you are using dangerous obsolete code that has been completely removed from PHP. You need to use PDO with Prepared Statements. There is no "fixing" this code. This tutorial will get you going. https://phpdelusions.net/pdo You are also mixing mysql with mysqli. Whatever "tutorial" you are following, toss it. And next time post the actual code using the code tags. Pictures are for hanging on the wall.
  11. benanamen

    Pull table data from .html file into mySql

    Ok, one more question, what is this extract process and how does it work?
  12. benanamen

    Need help getting last insert id from mysql

    Your approach is flawed. You need to use Prepared Statements. I highly suggest you use PDO as well. This tutorial will get you going. https://phpdelusions.net/pdo
  13. Any questions about using FrontPage are irrelevant. That application is severely outdated. The only thing you should be doing with it is deleting it from your system and getting current with one of the numerous modern editors available both free or paid.
  14. benanamen

    Pull table data from .html file into mySql

    I have a slightly off-topic question for you OP. A source that only has an html output doesn't sound like they intend for you to take this data for any other purpose. It sounds like you may be trying to scrape a page somewhere. Do you even have permission from the data source to do this?
  15. benanamen

    Return image after If statement

    Yeah, that's what I get for being more concerned about coming across as reproving an established forum member. The point, as you rightly support is that error reporting should be set in the ini file.
  16. benanamen

    Return image after If statement

    While that indeed will work, you have now littered your code base with redundant error settings that will have to be edited on every page when you upload to production. The "better" method would be to set those setting one time in one place in the php.ini on your local dev setup.
  17. benanamen

    php session variable html not rendering

    Yeah, I finally figured out what the op was trying to say. Post was not worded very well. I edited my post as you were posting.
  18. benanamen

    php session variable html not rendering

    I think I misread the post. The redirect is obviously not right, but what html is not showing up? You mean your not seeing the usrMsg in the source? You have already unset the variable so it's not going to be in the source.
  19. benanamen

    php session variable html not rendering

    Problem is single quotes vs double quotes. $_SESSION['type'] is echo'd with single quotes and therefore will not interpolate the variable.
  20. benanamen

    Return image after If statement

    As a fresh noob one of the very first things you need to learn before writing any code is how to turn on and display errors. If you had done this PHP would have told you what is wrong.
  21. benanamen

    Can't change color of a field

    You have numerous basic errors. You are missing a period before the RED css. You are also missing quotes on your row variables. If you had error reporting turned on you would have known about that. If you used single quotes in your html strings you wouldnt have to do all that escaping. The center tag is obsolete. You will also get an error with your row[id]. It will need to be {row['id']}. If this is not for tabular data, then don't use tables
  22. benanamen

    preg_match in statement

    OP, tell us what the real problem you are trying to solve is instead of your attempt at solving it.
  23. I agree with @ginerjmm, learn PDO instead. This tutorial will get you going. https://phpdelusions.net/pdo You can also download my PDO Bumpstart Database. It will help you get going quickly with the basics. https://github.com/benanamen/pdo_bumpstart_ver1.6
  24. benanamen

    DB query not working

    For starters you have several mismatched curly braces. If you used a proper IDE you would spot basic errors like this right away. I would also suggest you learn one of the standard code formatting styles and stick to it. You also have a substantial amount of duplicate code. DRY - Don't Repeat Yourself.

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.