-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
Please Read before posting here for PHP Help
.josh replied to revraz's topic in PHPFreaks.com Website Feedback
I always read the fine print. People put all kinds of crazy stupid shit in there that you're just like wtf...is this really legal for them to say? Like the parts about how you agree that whatever decision they make overrules any court of law sort of stuff. Seriously? You can agree to give them that power and it's actually binding? So they could like, take my firstborn child and the cops would be like "Sorry, you signed the contract...". I always think its funny when I'm somewhere getting something that involves signing a contract, like buying a car or getting a new cell phone plan or something. Its funny watching the sales guy out of the corner of my eye fidgeting and making dirty faces. Sometimes I pick random obscure things in the contract and ask questions about it to make him squirm even more. As if he really knows the answer. As if he actually read the contract he's trying to make me sign. No its not that hard to make a quick sticky. But a) there is a difference between rules and guidelines. What many people think should be rules are actually guidelines, because it is not our duty or desire to be the proverbial grammar police. b) As pointed out, most people don't bother reading the stickies. No point in making them if people aren't going to read them. Even if you link to it as a response to a "bad post," I assure you, they are not going to follow the link and read the sticky. -
true story! My friend said one time he started yelling into his speakers because his computer wasn't doing what he wanted it to do and all of a sudden windows made a popup saying 'stop yelling'. He swore up and down the computer heard him through the speakers and how there was a huge microsoft conspiracy and stuff. We found out a week later it was his mom in the other room IMing him to stop yelling because he was being loud (in his defense, he was pretty baked at the time...)
-
I'm not necessarily opposed to their advertising word games, anymore than any other advertising word games out there. That's nothing new, and has been around long before the internet. My main opposition is when they turn around and blast people for trying to make good on it. It's like a fat guy getting kicked out of an all-you-can-eat buffet for eating too much food. If you wanna build a business based on gambling on average use, that's fine. But it's not fine to turn around and kick a guy out for using "too much." I don't necessarily consider it false advertising to say it in and of itself. I consider it false advertising to turn around and say "..but you can't actually use that...or even a finite amount past N..." in the fine print.
-
I'd start with a recorder (voice if just voice, video recorder if you want video too). That's just me though.
-
How to select from mysql where one column value is higher
.josh replied to t_machine's topic in MySQL Help
select * from tournament_ids where player_1 > player_2 (* will select all the rows. I suggest you only select the columns you need) -
okay maybe I'm misunderstanding you, but you don't want to base your pagination off of the total rows in your table unless you are wanting to display all of the rows in your table (which I don't think you're wanting to do...hence the big long query full of conditions). You have conditions in your query to return only x amount of rows from your table, and the goal is to paginate just those results. So for instance, if you have a total of 500 rows in your table, and your conditions select 100 of those rows, you want to paginate based off those 100 (for example, 10 pages of 10 rows), not based off of all of your rows (50 pages of 10 rows). So you would still use COUNT in your query and base the total pages off of that count, because that count will return how many rows were selected by the query.
-
dunno if its necessarily faster or not, but you could also do this: $array = array('page_1.php', 'page_2-1.php', 'page_2-2-1.php', 'page_2-2.php', 'page_2.php', 'page_3-1.php', 'page_3.php'); function format(&$file, $key, $t) { $file = ($t == 'strip')? preg_replace('~(page_|\.php)~','',$file) : 'page_' . $file . '.php'; } array_walk($array, 'format','strip'); sort($array); array_walk($array, 'format','build');
-
post your query. I see no reason why you can't put the limit on there. That shouldn't interfere with whatever count you are doing in the query...the limit just returns x amount of rows with an offset (if specified), after everything is said and done. so, whatever query you're doing, it will internally select whatever the condition dictates, etc.. but will actually give you just the limit at offset from that result.
-
really, because when I ran his script, I got Array ( [0] => 1 [1] => 2 [2] => 2-1 [3] => 2-2 [4] => 2-2-1 [5] => 3 [6] => 3-1 )
-
Thank you to all who help out
.josh replied to maddogandnoriko's topic in PHPFreaks.com Website Feedback
I like peas. -
you would have to learn java or vb or c++ or vc or delphi or some other language capable of creating stand alone applications. If you want to make a web based app, you can learn js/ajax or flash to make an interface that would run in your browser and communicate with your server in real time, using php or some other server-side language for the backend to communicate with the database.
-
it's a modulus operator. It divides one thing by another and returns the remainder. The idea is if you divide the counter by the columns and it returns a zero remainder, you've reached a column count divisible by 5, or in other words, the 5th column in the current row, so start a new row.
-
$cols = 5; // number of columns here $count = 1; while(some condition here that loops through results) { if ($count % $cols == 0) { echo "<br />"; // or close a tr and open a new one, etc.. $count++; } //whatever code here
-
you can't have more than one target in your form action but there are lots of ways you can submit to two places. You can do it clientside with some javascript. Use an onclick or onsubmit to call a function that opens up a new window and submits a duplicate form (with info) to a different url. In your target page from your form action (the "processing script") you can have php submit the info to the other site, using curl. To name a couple.
-
not a php issue... thats just how html renders it. Need to use the html code or the pre tag or add some other tag around your items and add padding or margin with css.
-
Did you know, in the time it took to watch that video, I ate 3 handfuls of trail mix 10 years ago, I could not have said the same thing, because it didn't even exist. Or the video...DID YOU KNOW????
-
btw I'd probably make that regex more like this: $data = preg_replace("language_id = '\d+'", "language_id = '$dig'", $data); That other regex will change any 1 digit number between single quotes. This will change any 1+ digit number between quotes that's preceded by 'language_id = ' If your numbers will always be single digits and that will be the only thing in your string with a digit, then the previous one will be okay.
-
well I'm glad you got your problem solved. If you had worded it that way in the first place, you would have gotten an answer a lot sooner. Your 2nd explanation "sounds" simpler to you because you know the context of your situation. We don't. We aren't psychic.
-
well maybe you should un-summarize it, because it sure sounds like you're just wanting to use a variable...
-
umm...if you want it to always be 1, just hardcode it as 1 instead of 5.... if the id is going to change, that's not regex, that's using a variable, like $id = 1; ... "select * from table where language_id = '$id' and date = now()";
-
My point is that if he had the ability to insert delimiters around target data, he wouldn't need to be regexing for it in the first place.
-
I suggest you look into an ajax based file uploader for multiple file uploads. The backend php code would be the same but you would use javascript to loop through each file and send it one at a time.
-
One would think if he had control over putting custom tags around the urls to be extracted, he wouldn't need to be regexing in the first place.
-
It's a text file. The only thing special about a text file is whether there are end of lines in there or not. The worst that can happen is if you explicitly remove them, you won't have stuff on their own lines anymore. The code I provided doesn't touch what may or may not already be there. In fact if anything, maybe it should, since he wants the end product to be a list, and any new lines originally there would create blank lines.
-
$string = preg_replace('~[^a-z ]~i','',$string); $string = str_replace(' ',"\n",$string);