-
Posts
15,266 -
Joined
-
Last visited
-
Days Won
431
Everything posted by requinix
-
Rewrite what and why?
-
Actually yes: look at the initial characters of the outputted hash (how many of which depends on the hashing algorithm). But you did notice that you can pass crypt() your own salt, right?
-
If the string actually includes "renderOptions" then you're pulling from the wrong page. You should be getting strictly JSON back: {"results":[{"locations":[{"latLng":{"lng":-112.35984,"lat":34.58752},.....
-
You wouldn't have to use eval() for it. Just access it through the window object. window["itm" + i].model Ah, the flexibility of JavaScript.
-
The namespace does add a bit of complexity, but it's still easier to deal with it than to use an array. $xml = new SimpleXMLElement( card 12345KKLS 709750ba-b9b6-44c4-9812 70 USD 2011-05-11T07:41:44.957 4 e0c66bae-c423-43c6-b896 50 USD 2011-05-11T07:42:13.55 2 XML , 0, false); $xml->registerXPathNamespace("ns", current($xml->getDocNamespaces())); $node = current($xml->xpath("//ns:Payment[ns:StatusID=4]"));
-
Just like in PHP, don't use multiple numbered variables - use an array. // create the various objects var porche = new Object(); porche.make = "porche"; porche.model = "boxter"; // put them into an array itm = [porche]; // then loop over it for (var k in itm) { $("#writer").append(itm[k].model + " "); }
-
Have you written any code to actually get the information from the database? What is it?
-
I myself am a fan of doing as much work in PHP as is reasonable, so $start = mktime(0, 0, 0); $end = mktime(23, 59, 59); $query = "SELECT * FROM contacts WHERE lastupdated BETWEEN $start AND $end";
-
That's an okay query if you get one day's events at a time. But it means ~30 queries just for that. SELECT * FROM calendar WHERE `date` >= first of the month AND `date` That will get you everything in one query. Inside your for loop you need to iterate over that resultset. Keeping the [code=php:0]$row_Recordset1 = mysql_fetch_assoc($Recordset1);
-
Well yeah. All your code does is get one single row. And it might not even be in the time range you're displaying. You need the right query, one that only pulls events from the database if they're on the calendar you're trying to show, and then you need some logic in the for loop to advance through the rows as you advance through the days. So what query do you think you should use? It needs a WHERE and an ORDER BY at a minimum.
-
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](?