trq
Staff Alumni-
Posts
30,999 -
Joined
-
Last visited
-
Days Won
26
Everything posted by trq
-
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.
-
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.
-
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.
-
Php Issues? Php Not Receiving Post Data From Htmll Form
trq replied to gdisalvo's topic in PHP Coding Help
Please post the relevant code here. -
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;
-
Flaw In Php's Namespace, Cannot Import An Entire Namespace,
trq replied to Hall of Famer's topic in Miscellaneous
It illustrates a general lack of understanding. -
You need to return these variables (within an array) from the function.
-
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?
-
Flaw In Php's Namespace, Cannot Import An Entire Namespace,
trq replied to Hall of Famer's topic in Miscellaneous
It is comments like these that make your opinions less and less respectable. -
Display All Records Using A Link Either Html Or Php
trq replied to ianhaney's topic in PHP Coding Help
Your going to need to be more descriptive I'm afraid. -
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.
-
Free Domains Which Provide Ini File Editability
trq replied to s4surbhi2218's topic in Other Web Server Software
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. -
Subscribe/unsubscribe To/from Article Using Php/ajax
trq replied to dave1234's topic in PHP Coding Help
Your question makes little sense. -
Why While Loop Is Not Working Inside A Class?
trq replied to Sanjib Sinha's topic in PHP Coding Help
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.- 8 replies
-
- while loop
- class
-
(and 1 more)
Tagged with:
-
Subscribe/unsubscribe To/from Article Using Php/ajax
trq replied to dave1234's topic in PHP Coding Help
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. -
Optimize Code. Is This The Optimum Way To Insert Data Into Tables?
trq replied to BrettHartel's topic in PHP Coding Help
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. -
Subscribe/unsubscribe To/from Article Using Php/ajax
trq replied to dave1234's topic in PHP Coding Help
You will need to show us an example. -
Flaw In Php's Namespace, Cannot Import An Entire Namespace,
trq replied to Hall of Famer's topic in Miscellaneous
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. -
A lot of people are tricked easily.
-
Nor does it have anything AT ALL to do with the W3C.
-
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.
-
ps: Sorry about the formatting. This forum software sux balls.
-
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.
-
What does the W3C (and there site) have to do with PHP?