-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Need to sum up arrays, if the same mainkey appear different files
requinix replied to JalaVill's topic in PHP Coding Help
Dump all that data into a database, then you do a query to get whatever you need from it. It'd look something like SELECT SUM(points) FROM table WHERE player = "Player1" AND date BETWEEN "starting date" AND "ending date"The "date" would be what the file corresponds to, or maybe when you import it. -
301 redirect from .aspx to .php via .htaccess
requinix replied to flaesk's topic in Apache HTTP Server
Redirect is better, and decode the URLs first. Redirect permanent /Om\ Kuren.aspx http://mydomain.com/om-kuren.phpIf you have Apache 2.2.6 or later then you can omit the "http://mydomain.com". Pretty sure the escaped space works. Otherwise RedirectMatch permanent ^/Om.Kuren\.aspx$ http://mydomain.com/om-kuren.php -
And when that happens you'll have to add the new fuel type to any place that references them, test the changes, fix resulting bugs, test again, and deploy the new code. Performance alone is not a good enough reason to denormalize.
-
Hydrogen. Electric. Biodiesel. Just because you can't think of more doesn't mean they won't happen.
-
You can do it just fine in the code, you know. SELECT Gas + Gasoline + Diesel AS Total FROM MoneyAlso looks like your table isn't normalized...
-
>_> You need an avatar.
-
b.php is not waiting for a.php. Your browser is. b.php finished executing and now your browser is trying to get a.php. The only reason you think b.php is still executing is because your browser has not yet changed the address bar to say "a.php". What you want is what jcbones is basically telling you: send all the headers so that the browser thinks the script is done, then keep script executing. You don't even need to sleep(). IIRC it's something like ignore_user_abort(true); header("Location: a.php"); header("Content-Length: 0"); header("Connection: close"); flush(); // keep executing
-
We'll stop caring when you finally post the code you're having problems with.
-
It hasn't halted in b.php: your browser got the redirect just fine but it's waiting for the result from a.php to tell it what to do next. For all it knows it's about to get redirected again. It's not showing you the new URL yet because it wants to wait until it knows it's getting content back to display.
-
You don't have to really "split" anything. Just make the leftbar read four results and the rightbar read whatever is remaining.
-
Considering how it works for every other person, have you tried checking if the data itself is wrong?
-
$object->set_sqlstr(htmlspecialchars( "SELECT `cat`.*,`rooms`.* FROM `cat`,`rooms` WHERE `cat`.`id` = `rooms`.`catid` ") );There's no HTML in there. Don't use htmlspecialchars(). SELECT `cat`.*,`rooms`.* Don't SELECT * when you only want a couple columns. Specifically name the ones you want. $object->no_rowsIs it really called "no_rows"? Not, like, "num_rows"? if($num=0){Not enough =s. $object->data['room-name']Is it really named with a hyphen? If so, that better be because the $object thing added it and not because your column is actually named "room-name". Are you sure that is what's happening? Have you verified that the HTML you've outputted has the wrong ID there?
-
Stop. They specifically prohibit you from doing that: Find another way or a different place to get the information you need.
-
And that code you posted was flawed. What's your code now after the changes you said you made?
-
What's your code and how is it "not working"?
-
Got a couple ); in the PHP that don't belong. There's also a harmless but unnecessary semicolon after the if block. [edit] Find your php.ini and set error_reporting = -1 display_errors = onThen restart your web server. With those changes you should get error messages from PHP that'll make it a lot easier to find where problems are.
-
Use absolute paths whenever possible, either using the DOCUMENT_ROOT or __DIR__. // works regardless of where you are include $_SERVER["DOCUMENT_ROOT"] . "/folder1/folder1file1.php"; // have to know the relative path between the current file and the one you want include __DIR__ . "/../../folder1file1.php";
-
Poor OOP practices that programmers should avoid
requinix replied to Hall of Famer's topic in Miscellaneous
My serious project uses a handful of global variables. Because it actually needs global variables, as in variables that are accessible globally. It's not possible to do anything else besides cover up the fact that the values are global: function with a static variable is still essentially global, something OOP and static is still essentially global. I guess the argument I'm making is one that I would apply to most of the bullet points you had to start: just because something can be misused doesn't mean it should not be used at all. Eventually you'll realize that "OOP code" looks the same as "procedural code" except that sometimes the functions have weird ->s and ::s in their names. Nightmarish procedural code is a nightmare to deal with, but so is nightmarish OOP code. Fact is a poor programmer who isn't familiar with the tools available will write bad code one way or another. If you come in here and start telling people what they should and should not do, we will start pointing out the "unimportant" and "minor" flaws. -
With a link of sorts. $_GET information comes from URLs so you have to make them visit that URL one way or another. Could be AJAX.
-
Right... What's your point? I'm saying you shouldn't be caring about BSTs in MySQL. It's just a search. That's all you do. MySQL does the search however it feels is best and you get the results. Want to show just "John" stuff? Then only query for "John" stuff.
-
Need to require either one or another option be completed in form
requinix replied to jdutton's topic in PHP Coding Help
In this case you actually want "and": if the email address is empty and the phone number is empty (then send them to the error page). && ... || (empty($email) && empty($phone)) || ... -
I'd also like MySQL but with SQL Server's tools. [edit] Actually in general I like MS's software development tools. Like Visual Studio Hardly. To name a few things: - Drivers. Unless it's not available for your system (eg, not running on Windows), use sqlsrv instead of the defunct mssql extension. But sqlsrv has its own requirements too. - Do you use ...LIMIT X in your queries? Change that to SELECT TOP X... - Use LIMIT X, Y? Change it to something more complicated - Quote names? []s and "s instead of `s. - Quotes with strings and dates? By default you have to use single quotes. - Do you sometimes SELECT non-aggregated columns that aren't present in the GROUP BY? SQL Server doesn't allow that. - Rely on magic_quotes? For one, stop that right now. For two, that won't help you with T-SQL's quoting style.
-
The whole point of using a database is so that you don't have to do the manual searching by yourself...
-
How's the CPU and memory usage? Are the application pool settings limiting resources? Bandwidth constraints?