Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. The scanners just send a string of data. This can easily be captured as input, no different to someone using a keyboard and a form.
  2. We use barcode scanners with the applications I work on with at work. They communicate to PHP on the server without issue, client side, the data is handled by Javascript. From there, its just simple Ajax calls. In regards to printing. Most of our printing is done via PDF's. We have a Java applet that handles the client side of things, but a lot of this could potentially be done via the native browser print dialogs.
  3. Indeed. Read this, functions. You don't seem to have an understanding of functions. Functions have there own scope and encapsulate the functionality the provide. To do what you want, GenerateSitemap() needs to return the data you need, while secondfunction() needs to accept an argument so you can pass this data in to it. The end result would look something like: <?php $title = GenerateSitemap(); secondfunction($title); Having said that however, it seems GenerateSitemap() is a pretty silly name for a function that returns some $title data.
  4. Potentially. Though I get the impression it's not. In that case though, I would use something like: SELECT IF (COUNT(id) > 2500, 2500, COUNT(id)) AS total FROM tbl;
  5. You need to return these variables (within an array) from the function.
  6. This will return 2500. The point of my original reply was not that it couldn't be done. It is that it makes NO SENSE to do so. The number the op wants is 2500, why run a database query to get it?
  7. It is comments like these that make your opinions less and less respectable.
  8. Your going to need to be more descriptive I'm afraid.
  9. You are kidding right? You want a count of how many records there are in your query but limit it to 2500 ? That would be 2500.
  10. I think you might be confusing server hosting with domain registration. They are two completely different subjects and are not really related. As for free hosting which allows you to edit php's configuration. Your dreaming. You get what you pay for.
  11. Your return statement needs to go outside of your while loop. This has nothing to do with the fact that your code is within a class. As has already been said, return exits the current function. The code within your while loop is all over the place anyway actually. Replace your while loop with this: $results = array(); while ($row = mysql_fetch_array($cat)) { $results[] = $row['name']; } return $results; I would also seriously consider removing your classes all together. They are not being used at all like they are designed to be used.
  12. Your going to need to let us know where exactly you are stuck. I meen, all you would need do is add a button that toggle between a user being subscribed or not. Sounds super simple to me.
  13. It's a pretty simple query, I wouldn't worry to much about trying to optimise anything. Security wise though, your code sux fat ones. Never let user submitted data be used in a query like that. Without at least some sanitisation and maybe some validation you are leaving your application open to be compromised.
  14. It's just a non-issue IMO. Who really cares? It's one character and is part of the language. Learn to use it, and get on with things.
  15. Nor does it have anything AT ALL to do with the W3C.
  16. Learn to walk before you try to run. PHP is a programming language, and as such, you need to learn how to program to use it successfully.
  17. ps: Sorry about the formatting. This forum software sux balls.
  18. Routing is one of those things that requires a certain amount of complexity to achieve flexibility. You could easily solve part of your problem by simply directing all traffic to an index.php page containing a switch statement that maps urls to included files: switch (true) { case $_SERVER['REQUEST_URI'] == '[color=#282828][font=helvetica, arial, sans-serif]forums/threads/some-cool-thread':[/font][/color] [color=#282828][font=helvetica, arial, sans-serif] include '[/font][/color][color=#282828][font=helvetica, arial, sans-serif]sources/forums/threads.source.php';[/font][/color] [color=#282828][font=helvetica, arial, sans-serif] [/font][/color][color=#282828][font=helvetica, arial, sans-serif]break;[/font][/color] case $_SERVER['REQUEST_URI'] == '[color=#282828][font=helvetica, arial, sans-serif]members/register[/font][/color][color=#282828][font=helvetica, arial, sans-serif]':[/font][/color] [color=#282828][font=helvetica, arial, sans-serif] include '[/font][/color][color=#282828][font=helvetica, arial, sans-serif]sources/members.php[/font][/color][color=#282828][font=helvetica, arial, sans-serif]';[/font][/color] [color=#282828][font=helvetica, arial, sans-serif] [/font][/color][color=#282828][font=helvetica, arial, sans-serif]break;[/font][/color] } This however doesn't solve your issue with extra paramaters being passed. As soon as you require that, you need to start using regex and thing can start to get more complicated. You will also eventually require more flexibility than you can achieve with the simple example above. If your trying to write your own because you want to learn more about how its done. All well and good, just think the problems through as they arise. Be aware though, to make a decent router, your going to need to make a trade off between complexity and flexibility. If you just want to get a router in place and move on. Why not use an existing routing component? Symfony provides it's routing implementation as a component that does not require the framework itself. Hell, even my framework (Proem) has a decent router which I am currently in the process of separating out into it's own package. Don't reinvent the wheel unless you have/want to.
  19. What does the W3C (and there site) have to do with PHP?
×
×
  • 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.