-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
Once you compile a php application using one of these compilers it no longer needs any other software to run. Right. Like I said, I understand that. What I mean is I thought he was saying that php didn't even need anything at all. Like...open up a text file, write your php, save as an exe and blam, it automatically works. You know what...I knew that. For some reason last night and now this morning, I meant to say python but for some reason I said perl.
-
I know that once something is compiled, it no longer needs the compiler. I was responding to this: I thought he was saying that unlike full languages like java/c/perl, php doesn't need any software installed at all. Perhaps he meant as far as even after compile? I know java still needs a jvm installed to run. I don't know if perl needs anything, but c doesn't. Overall I would recommend to the OP that if he wants to get into stand alone applications, he should use c instead of php. php is written in c, the syntax is pretty much the same, and c has all the power of php and more.
-
if (!$_SESSION['firsttime']) { echo "msg here"; $_SESSION['firsttime'] = true; }
-
echo $query and try running that directly in phpmyadmin, do you get the desired result?
-
uh...no software needed? PHP doesn't run all by itself...you need the parser and a webserver like apache to run it... compared to what, a basic compiler for one of those? Sure, there are sdk's and gui's that make developing in them easier, but you don't *need* them.
-
Yeah MadTechie I can see how that might be "useful" or at least *more* "useful" but shedokan says that the included file connects to the db and displays something, which I really don't see any kind of good design in doing that.
-
There's really no way anybody can help you on this... first and foremost the formula is gonna have to be balanced with the rest of your game, which we know nothing about. For instance, is the base (no xp) supposed to be a 50/50 coin flip? And how much more per xp do you want it to lean in favor? A basic formula could be like so: start out with a 50/50 coin flip. That means there's 50 "points" to lean in your favor. Assuming xp goes from 0-100% you could do say, 0.5 points per xp % so if you had 10% xp the coin toss would be 55/45. But does that throw off the balance in your game? Only way you're gonna be able to figure that out is trial and error and tweaking it based on observation of a live game (be it a beta or final or w/e).
-
Honestly I think if you're gonna go into all that just use a full language like c or perl or java.
-
well but I'm also saying that if you have 3 fields and fill out all 3 of them, your posted array positions will be: $_POST['tall_chicken'][0] $_POST['tall_chicken'][1] $_POST['tall_chicken'][2] but if you only put text into say, field 1 and field 3, it will not be positions $_POST['tall_chicken'][0] $_POST['tall_chicken'][2] it will be $_POST['tall_chicken'][0] $_POST['tall_chicken'][1]
-
As mentioned, pagination is what you're looking for. Here is a link to our own tutorial: http://www.phpfreaks.com/tutorial/basic-pagination You're gonna have to modify it a bit to suit your needs, because you're dealing with a large block of text instead of lots of rows. Best way to go about it is to make "keywords" like [pagebreak] where you want the pagebreaks to be. Or you can make pagebreaks based on how many words or lines per page. That's entirely up to you. But whatever you do, you'd add a counter into that to determine how many pages you have total and use that for the part of the script that has the page links.
-
"huh" as in you don't understand? or "huh" as in "that's interesting" ?
-
Also fyi, the array will always go from 0 to whatever, even if you clicked say, the 2nd and 3rd option, but not the first, the array elements will still be 0-1 not 1-2. Or if you entered in something for #1 and #3 the posted array will still be in positions 0 and 1 not 0 and 2. If for some reason you need to know what position they are in on the form, you need to specify an array position not just do [] in your form.
-
well aside from the fact that you don't have form tags, that should work just fine. edit: though, I'd personally use a foreach loop instead of counting and using a for loop.
-
well then (again, just a guess, seeing as how I don't have the script in front of me) I'd say they poorly coded it.
-
yeah if you want to nickel and dime it, even though php has to process the same amount of code, doing include "wholefile.php"; is physically less than doing include "file1.php"; include "file2.php"; include "file3.php"; include "file4.php"; but we're talking 4 small statements vs. 1 small statement here.. I don't think you can even measure the difference in processing time... Well I don't think we can really give you a solid answer without more information (like, what script, what file, what code, etc..) but if I had to take a guess I'd say it's probably some kind of resource file that connects to the database that is being included across various pages. But again, that's just a guess, since I'm not looking at it.
-
If the amount of info is the same (length of file overall) and everything is being included always, I really don't think there's a difference...everything is read and parsed just the same. I mean, that's kind of like saying you need to count 100 pebbles and you have two piles of 100 pebbles one is one giant pile the other is split up into 5's or even individually. Either way you have to count each pebble.
-
php doesn't support threading (asynchronous processing). Google "php forking"
-
please use code tags when posting code. Also, you're going to have to be more specific about your problem.
-
[SOLVED] How to MAKE the query string show up in the address bar?
.josh replied to sd9sd's topic in PHP Coding Help
why would you want to do that? -
I'm not sure that it's called anything special... you just add the multiple tage inside your select and make the name an array. example: <?php if ($_POST) { print_r($_POST); } ?> <br /> <form action = '' method = 'post'> <select name = 'blah[]' multiple> <option value = 'a'>a</option> <option value = 'b'>b</option> <option value = 'c'>c</option> </select> <input type = 'submit' value = '>>'> </form>
-
you select more than 1 by ctrl clicking items. As far as your 2nd question, that's somethin' done with javascript.
-
aside from the fact that you didn't put quotes around "Attack" when you assigned it to $skill, that code should work the way you want it.
-
please do not make multiple threads asking the same thing. Instead, post this in your other thread as clarification to your problem. edit: reopened as you say this is a diff problem...
-
? function getXp($skill) { // do something } for ($x = 0; $x < 10; $x++) { $val = getXp($x); $blah[$val] = $val; } // you now have an array called $blah // example to loop through array foreach ($blah as $val) { echo "$val <br />"; }