Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. I can make you a script that will do that but I work for cold, hard cash.
  2. well if someone is putting something like that in the url then they are probably trying to break it in the first place, and that 1 in '1 would just be some arbitrary value. Instead of trying to filter out a number in the midst of an obvious attack attempt, simply display a default page number if it's not a positive integer within the page range.
  3. maybe I'm not understanding, but shouldn't you be able to just use isset?
  4. nrg_alpha's code works fine on the example data you posted. You said that the data is being stored into $response. Did you change $str to $response in nrg_alpha's code?
  5. .josh

    Option?

    <?php while ($row = mysql_fetch_array($result)) { echo "<option value = '{$row['flightnum']}'>{$row['flightnum']}</option>"; } ?> </td></tr>
  6. $oldBook = file_get_contents("lrn2php4.txt"); $newBook = preg_replace('~php4~is','~php6~',$oldBook); file_put_contents("lrn2php6.txt", $newBook);
  7. They made it by basing it off of php5 and accounting for what php6 currently does. In short, the whole "php6" is a marketing ploy.
  8. Okay here's the bottom line: You went and setup some database locally, which doesn't really help you out at all, as far as having a database on a server, except that I suppose you can export the structure and data and import it (hopefully, if it's compatible) into the server's database. You went and got some scripts that theoretically interact with this database, but judging from your questions, I wouldn't doubt if you just got some random script and you have no idea whether it can interact with database or not. On top of that, you went and got a host that offers some webspace for like what, $5 a year? You are not going to be able to setup a database and run scripts on a server with a plan like that. Quick skim of that place and it looks like they basically let you upload some static files to make a static website. I think they might actually let you use some perl scripting if you upgrade. I didn't look that far into it. Point is, at the very least, you're going to have to get a better hosting plan. And after that, you're going to need to make an effort to learn how everything works together, or else hire someone to do it for you. It's not some easy 1-2-3 easy process, unless you know the environment in the first place. (edited to fix some grammar)
  9. Ask for a hit on the peace pipe?
  10. It depends on your server. Apache? IIS? Using cpanel? there are 100 questions that would need to be answered. That's like asking where/how to change the oil in your car but not telling us what year/make/model/etc.. your car is. Anyways, I don't think you really want to have your html files parse as php. Assuming your server even has php installed, it would be easier for you to just rename your file.
  11. if you have php in your html page, then yes (unless you set your server to parse html pages as php...)
  12. You can do echo "<pre>"; print_r($matches); To see the structure of $matches. Read the manual on how preg_match and preg_match_all works, and what is returned and how it is returned and more importantly, why.
  13. It depends on the circumstance. But overall, the "standard" is to separate code from content as much as possible. Like for instance, in your examples, you should be assigning the text to a string and passing it to a page meant only for displaying results, not mixing logic and output. Read up on MVC (model view control).
  14. preg_match_all
  15. because you were missing a closing bracket for that while loop. But even if you were to put it in, your script would just be broken in a different way. You don't have a query with $result before it, so it would have never evaluated true. Basically it looks like that first while loop shouldn't even be there. Or maybe it should. You're trying to echo $row['id'] but you never actually run a query before that. If you're trying to do two queries, you're missing stuff. If you're trying to do 1 query, you have too much stuff. You said that commenting out that line makes it do what you want, so I guess you were aiming for 1 query so take out that first while (...) and take out that echo $row['id'] because it's a useless variable.
  16. did you put the right path/to/font in the script? The tutorial assumes it is in the same directory as the script.
  17. http://www.phpfreaks.com/tutorial/php-add-text-to-image
  18. follow the tutorial. Put the trigger_errors on the end of you mysql_xxxx's it will tell you what's going wrong. That's why they are there.
  19. foreach ($test as $key=> $person){ echo $person . " "; echo $test2[$key] . " "; echo "<br>"; }
  20. http://www.phpfreaks.com/tutorial/php-basic-database-handling
  21. nah. Next end of the world date to look forward to is like Dec 21st 2012.
  22. Does it matter? It will take them in either order. It's like the chicken vs. egg debate. People get hung up on it, but it doesn't matter; beat them enough and they both will cream, just the same.
  23. If the gates of hell really do open and this is the end, it's been nice knowing you guys.
  24. holy crap it totally forgot about that. And it's Fri 13th... OH NOHS TEH APOKALIPSORZ
  25. .josh

    PHP and OOP

    [Mis]using it as a namespace: exactly. It's the same principle as doing this: // example A $max[0] = 10; for ($x = 0; $x < $max[0]; $x++) { echo $x; } vs. this: // example B $max = 10; for ($x = 0; $x < $max; $x++) { echo $x; } All by itself, example A is pointless. You do not need to be using an array to hold what you want to count to. It's unnecessary; overkill. Instead, just use a simple variable, like in example B. Now, if you had a system that needed to keep track of different numbers to count to, then an array would be appropriate. But this by itself is pointless. And that's the thing. 9/10 times when I see someone saying OOP is pointless, they are looking at OOP as being like this example (and also using classes in this manner), instead of looking at the system behind it.
×
×
  • 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.