-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
This topic has used a town portal to get to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=359493.0 (Which implies it has been there before even though it obviously hasn't, I know)
-
This topic has used a waypoint to get to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=359489.0 How do I like it, you ask? Quite well. Besides the downtime Tuesday I haven't had any server problems, and the game itself is great. Very D2-esque but with very noticeable enhancements.
-
Add an AVG() and the rest should be obvious. SELECT playerid, SUM(points) AS points, COUNT(playerid) AS ronden, AVG(points) AS avgpoints FROM $score_table GROUP BY playerid ORDER BY avgpoints DESC
-
product.php?ID= There is no "price" in the URL.
-
accessing methods of outer class from methods in inner class...
requinix replied to Hall of Famer's topic in PHP Coding Help
That's actually a tricky question with many answers. If you're pulling information from a database then the generic answer is "when you do so is when you set up the User and/or UserAccount objects" (like in getprofile() or a constructor). But hold on a second. Why is the UserProfile dealing with the username? Why not have the User class do that? That's where the information is, after all. -
accessing methods of outer class from methods in inner class...
requinix replied to Hall of Famer's topic in PHP Coding Help
Shouldn't the UserProfile know whose profile it is? A bidirectional association: User has a profile, UserProfile has a user. -
...Is there any meaning behind posting the code again?
-
if (isset($error)){ Where is $error coming from? If you're about to say "outside the function" then let me reply preemptively with a "functions can't access variables defined outside of them" and how one solution is to have the function return the message.
-
This topic has been moved quickly to PHP Regex because I need to go to work instead of lurking phpfreaks. http://www.phpfreaks.com/forums/index.php?topic=359460.0
-
1. What error message on what line? 2. user_id_from_username assumes that the query returns something. Reality is that it might not find any matching rows.
-
How to communicate back and forwards between classes?
requinix replied to UrbanDweller's topic in PHP Coding Help
Why is it going from A to B and back to A again? Seems weird. Pass A to B's method. $B = new B(); $B->BA($this); function BA(A $a) { $a->AB(); } -
domain.com to go to https://www.domain.com/
requinix replied to johnsmith153's topic in Apache HTTP Server
That's not a "wasteful server action". Not even the server doing it. It's your browser. If you want it to. RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L] -
This topic has been moved to the corner of 3rd Avenue and mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=359430.0
-
Regex pattern to not match if string contains something.
requinix replied to huddy's topic in Regex Help
/(? [b](? -
mysql_error("sql1 failed") That's not how you use it. die("sql1 failed: " . mysql_error())
-
how to AUTO_INCREMENT 2 colloums not sure if this php or sql
requinix replied to nbbcj's topic in PHP Coding Help
And that's where my brain stopped reading your post. What's this "position" column for? -
I got that much, but what is going on beyond what you've described? Does the cloned table need to look exactly the same as the "master" table, or you do only want to import information from it? Could the two tables every look different in the slightest? Oh, and are they on the same database server?
-
You're calling mysql_query() too many times. Just once is enough.
-
The only other meaningful difference is whether files are web-accessible, but that doesn't require putting them in any particular place (like outside the web root).
-
Given what all you'd have to do to display a calendar on a page, your question doesn't make sense. You execute a query to pull everything during the month (or whatever time range) being displayed; as you're printing the calendar you're also walking through the list of events. When you're showing a day then you'll also know if there are any events for that day and, if so, what they are.
-
Use a database. Even if you don't think you need one now, you do. What you start off with are just four separate criteria. You could construct a single query that would give you the results you want, but that's a hassle. So start easy. Go through the criteria and find the instruments that match each one. Level=Advanced finds five so give them each a point and hold onto them. With Bowing Style=Hard you get four, all of which you've found previously - give them another point. For Musical Style=Rock there's one familiar one and two new ones - give them points too. Finally there's Desired Tone=Dark and two more familiar instruments (and one new one). More points. You can easily weight each category too by giving more or less points. You could start with a baseline of 10 points and say that "very important" = 15 while "not important" = 5. With a bit more math you can rank matching as a percentage. Once you've gotten that working you can have a go at a single unified query. It's actually not that hard if you were to, say, use a few UNIONs. # level=advanced is of normal importance SELECT 10, instrument FROM instrument_table WHERE level = advanced # bowing style is of normal importance UNION ALL SELECT 10, instrument FROM instrument_table WHERE bowing_style = hard # musical style is very important UNION ALL SELECT 15, instrument FROM instrument_table WHERE musical_style = rock # desired tone is also very important UNION ALL SELECT 15, instrument FROM instrument_table WHERE desired_tone = dark Throw that in a subquery then SUM() + GROUP BY the results and you've got a bare minimum.
-
What kind of clone? Copy or mirror? How much of it is cloned?
-
Of how a question mark works? Sure. abc -- matches only "abc" abc? -- matches "ab" optionally followed by a "c"
-
Hint: a ? means the thing before it is optional.