Jump to content

Andou

Members
  • Posts

    22
  • Joined

  • Last visited

About Andou

  • Birthday March 1

Profile Information

  • Gender
    Male
  • Location
    Codeworld
  • Interests
    reading, writing, coding, PHP, Python, SQL, video games, everything Gen Z does
  • Age
    19

Andou's Achievements

Member

Member (2/5)

2

Reputation

1

Community Answers

  1. What's a page (in this context)? Is it a webpage or something else? Is it one page or several? If it's one page, it should be easy enough to whip up a one-off. If it's several, how are you planning on storing the links to the pages? Database, array, or something else? How do you want to find the lowest price? Do you want to save a copy of the entire HTML and sort through it until you find the price? Or do you want to find the right element and pinpoint it from there? Both options work. How are you "adding the product"? Are you inserting the details into a database or saving the HTML to copy it over?
  2. Oops! I definitely have a lot more to learn. Great comparison, though.
  3. Considering around 77.5% of websites are using PHP (down 1%, but still way more than half), I don't believe them. I compare it to the concept of inertia - things that are spinning don't want to stop spinning.
  4. What I do is add <?php ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); to the top of the file. This lets me see everything. It's the same thing as what requinix suggests, just doing it using code instead.
  5. As far as it could be an error, try adding ini_set('display_errors', '1'); and error_reporting(E_ALL); at the top of your file. Also, regex101.com is a great website for debugging why the regex isn't working. It also has good documentation.
  6. I'll add that var_dump helps a lot when dealing with arrays. I always use <?php echo '<pre>' . var_dump($array); . '</pre>; so I can see what's going on with it.
  7. Glad to hear it! Sometimes, Google-Fu and putting stuff in quotes is the best way to solve problems. (By the way, if it's solved, there's a button you can click somewhere on the thread to mark it as solved.)
  8. A couple of things. First, put error_reporting(E_ALL); and ini_set('display_errors' 1); at the top of the file so we can see the errors. Second, I googled it and apparently calling "json_last_error()" after json_encode() may fix the issue if it gives you the error code. Try it, and if it still doesn't work, I'll see what else can be done.
  9. I don't know if the OP will respond, but just in case: have you done a mysql dump or gotten the issue sorted out yet?
  10. If I were you, I would have it so you upload a text file, like so (almost like pseudocode): BEGIN PAGE BEGIN TITLE = "My Web Page" END TITLE BEGIN BODY COMMENT "Your content goes here" END COMMENT END BODY END PAGE And then write a parser to detect "BEGIN" and "END" and replace that with the relevant html tag (i.e. "BEGIN TITLE" = <title>, "END TITLE" = </title>). This is what most template engines do, so I wouldn't necessarily do it myself or reinvent the wheel. (You would also be writing your own template language a la the parser, so I wouldn't do this unless I had to. Take it as a proof-of-concept.) * * * So, assuming you'd do it your way, am I correct in assuming this is how it works: You have a site. You upload a text file to the site. Your PHP code scans the text file and outputs HTML from it. But requinix is correct, we really do need a little more information. Is there any reason you can't use PHP itself to build the site? * * * edit: As it turns out, I put your query in google and StackOverflow has a solution.
  11. Dunno how helpful this is, but if I were you I would put all the relevant PHP code before the HTML so I didn't keep breaking in and out of it. I suppose the reason why the form is showing on the next page is that it's in the HTML, but someone with more experience may have a better solution.
  12. I'm pretty sure OP is asking what's wrong. A couple of things I noticed: You have no question (so far, anyway). I'm not a mind reader. I'd be happy to help, but I need to know what you're asking. Are you asking for help to fix an error? Or something else? I see that from the variable name alone, this is (probably) a school project. However, this leads me onto point #3, which is... Just because it is a school project does not mean you should forsake security. I see that your $sql variable holds a query vulnerable to SQL injection. If you like, read up on prepared statements or PDO. "passowrd" should probably be "password". You have no opening <?php tag. Quoting from @ginerjm's excellent advice, you should always put "error_reporting(E_ALL);" and "ini_set('display_errors', '1');" on top of the file so you can see what goes wrong. That's all off the top of my head, if I think anything else is wrong I'll come back to it. * * * edit: Oh, and yes, even though this is just a school project, keeping passwords and security information in the source code itself is a security hole. Assume, for instance, the site gets hacked. Now they have access to the DB itself.
  13. Andou

    New member

    Welcome to PHPFreaks! Nice to meet another fellow newcomer.
  14. Answering this a couple of days late in the hopes it helps someone - if you run into a situation like this, either stick "alert-success" in the div class itself or use a <style> tag, if it's only for that one section alone. Also, in the future if you run into issues and need our help, it helps if you put error_reporting(E_ALL); ini_set('display_errors', '1'); right after the opening <?php tag, so we can see what's going on. Glad to see you found a solution.
×
×
  • 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.