-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
I was going to initially suggest that, but thought maybe he had some specific reason he wanted to preg_match it. $string = "name_number"; $result = explode('_', $string); echo $result[0];
-
That line of code makes no sense. It is not syntactically correct in any way.
-
This is shorter: $string = "name_number"; preg_match("/(.+)_/", $string, $result); echo $result[1]; But I'm not a regex expert. Could be something better. The reason why that didn't work for you in your earlier post was because you forgot the 3rd preg_match argument (assigning result somewhere).
-
Can't blame a guy for trying.
-
What about the rest of the "evils"? There were 7 presidential candidates on my ballot. Okay let me amend that to "Lesser of the $x evils." So you were well-informed on every single candidate running, enough to deem them all "evil"? Informed enough to know that it doesn't matter who wins they aren't the person really in charge.
-
What does ILMV stand for and unless you post a pic of your gf we don't believe you. Scantily clad, please.
-
Um...no...that is not the same as Daniel's scenario. For the nth time, we're talking about poor people. Like, actual, real poor people. Mr. Obama did not grow up poor. Not even close. See you keep making it out like you've had it rough growing up, but quite frankly I call b.s. because a) You have referred to things that poor people just don't care about (insurance) b) You actually compared Mr. Obama's life story to Daniel's scenario, as if he was some poor black kid growing up on the streets of harlem, mom addicted to crack, dad some random guy out of any of the 100 his mom was forced to f**k to put food on the table. And then claim he goes from that to most powerful man on earth. Which leads me to.. c) You actually believe poor people have a shot at being the president. Sorry but I've never met a single poor person subscribe to that b.s. so either you're incredibly naive or lying, because that's a trademark middle-upper class belief. d) The fact that you're even on the internet, at a programming community speaks volumes. Now I'm not saying it's impossible for poor people to get on the internet or learn something useful. But what I am saying is that, like insurance, the poorer you are, the less meaning things like the internet are, compared to daily survival. While it is possible that you could have been one of those poor people who struggled and endured and against all odds broke through, it's more likely and with all odds, that you were/are not as poor as you make out to be. Now you can get upset with me if you like. You may honestly believe you had it rough. But even the poorest people in America have it 10x better than most of the world, and that's obviously not where you are right now. I don't think a whole lot of people really take the time to sit back and think about what they have vs. what they need. Don't really appreciate what they have or all the little tiny inconsequential things they take for everyday granted, not even thinking about how it could possibly be a big deal to someone else. I'm not trying to judge you. Lord knows, I've said and done a lot of things I'm not too proud of. I'm just saying, don't make the mistake of thinking life is that easy. Always be weary and suspicious of the easy choice. Always be weary of deciding on any kind of level whether someone else can do something or deserves something, because you haven't been in their shoes.
-
What about the rest of the "evils"? There were 7 presidential candidates on my ballot. Okay let me amend that to "Lesser of the $x evils."
-
Okay so if you are wanting php to perform a different action based on what was selected, then yes, you would use multiple if statements, or if/elseif/else statements, or a switch statement, or nested conditions, or whatever. Really depends on the situation. Variables posted from a form get stored in $_GET['varnamehere'] or $_POST['varnamehere'] (depending on the form method; can you guess which goes where?). From there, you would simply use conditions...just like flyhoney posted in his/her first post.
-
There's no way for me to tell you what's wrong with your code unless you post it. Basic example of using sessions goes like this: page1.php <?php session_start(); $_SESSION['somevar'] = 'something'; // example to get to next page echo "<a href='page2.php'>Page 2</a>"; ?> page2.php <?php session_start(); echo $_SESSION['somevar']; // output: something ?> But since you say you are using print_r on your 2nd page and it's showing your session vars (albeit empty vars), then looks like you have that part down. Which means you probably need to go back to page1 and take a look at what you're assigning to those session vars. Example: $_SESSION['blah'] = $blah; Well...is $blah holding what you expect? Again, I can't really be more specific than that without you posting code.
-
Or maybe beta test forum, in an indirect way.
-
Right. It's not displaying anything for the other ones, because there was no average to calculate from the query. As you said yourself: If you want it to print some kind of default or 0 or something, you can add a condition in the previous loop we were working on, to assign something to that element if nothing was returned.
-
6 options to google, in order of how I would personally do it: Sessions GET method Hidden form field Cookies temp database storage temp flatfile storage
-
Thread closed. Please post in the correct thread. Nub. how was that?
-
Okay the print_r($rating); is echoing out all the elements of your array each time your for loop iterates. So we can see from that, that on the last iteration, you have an array with 6 elements with no results except for one, which is what you said there should be. So you can now remove the print_r($rating); from your code, because you are now getting an array of expected results from your loops. So...is it still not displaying it in here? for($i=0;$i<count($Title);$i++) { $result=mysql_query("SELECT country,alias FROM country_list WHERE country='".$country[$i]."'")or die(mysql_error()); if(!$result){$sw=0;$error="No results please try a different <a href=reports.php>search 3</a>.";} else { $sw=1; $row=mysql_fetch_array($result); print "<div><div id=\"publish_edit_delete\"><div id=\"pagebreak_left\"><span class=\"black_small\">Not Published - Publish Now</span></div><div id=\"pagebreak_right\"><span class=\"black_small\"><a href=\"work.php\">Edit - Delete</a></span></div> </div><div id=\"abstract_edit\" \"margin-bottom:0;\"><a href=more2.php?id=$More><div id=abstract_image class=".$row["country"].">".$row["alias"]."<br /> {$type[$i]}</div></a><div class=\"abstract_header\"><span class=\"abstract_title\"><a href=more2.php?id=$More>{$Title[$i]}</a></span><span class=\"comment_stars\">{$rating[$i]}</span></div><div class=\"abstract_text\"><span class=\"black_abstract_small\">{$Abstract[$i]}</span></div><div class=\"abstract_town_link\"><div class=\"abstract_town\"><span class=\"grey_abstract_capitals\">{$name[$i]}</span></div><div class=\"abstract_link\"><span class=\"grey_small\">08/08/08</span></div></div></div> <div id=\"pagespace\"></div></div>"; } } If not, then next problem will probably be working on that horrible mess of a print "..."
-
Okay first off, get rid of this line: $rating=array(); It's not necessary to declare an array but more importantly, you have it inside your for(..count($Title)) loop, which is causing it to overwrite the array. That might not be the entire problem, but it's a step closer.
-
Unless there is some reason you are wanting to keep the values of the other radio buttons, there's no reason why you shouldn't be doing it the way flyhoney originally suggested.
-
Nope, shouldn't affect it. Okay next, change this: while($row=mysql_fetch_array($result)) { $rating[]=$row["AVG(rating_num)"]; } } to this: while($row=mysql_fetch_array($result)) { $rating[]=$row["AVG(rating_num)"]; } print_r($rating); } does it echo out the expected results from the query?
-
Okay did you try entering one of those query strings directly into your database to see if it returns expected results?
-
code highlighting > code completion in my book. In fact, many times I find code completion rather annoying.
-
It's really easy for you to say that when you're not in that situation. It's the proverbial "What would you (or wouldn't you do) if you had a gun pointed at your head or were offered a million bucks." People have a tendency to say one thing in theory and have a total change of heart in practice. To tell you the truth, the only reason that I have health insurance is because the company requires that I have it to work there. The only reason that I have auto insurance is because it is illegal to not have it. The last time that I was at the hospital, I was unconscious and 8 years old. If I cannot get over it myself, then I was not meant to survive it, and was meant to die. Okay but you still don't get it. Not having health insurance or car insurance is a luxury people pay for "just in case" something happens. I myself do not like the idea of paying for something that "might happen." We're talking about people who can't afford to put clothes on their back or put food in the mouth, let alone having a place to live or a means to get somewhere. What the hell does car insurance or medical insurance mean to someone shivering in the cold starving?
-
It's really easy for you to say that when you're not in that situation. It's the proverbial "What would you (or wouldn't you do) if you had a gun pointed at your head or were offered a million bucks." People have a tendency to say one thing in theory and have a total change of heart in practice.
-
Sarah Palin. I think even the people who did vote McCain were scared what woulld happen if he died and she took over.
-
Sorry but I think in your shoes, I would charge minimal prices. It really all boils down to what the guy wants, but I would stick to $10-$15 an hour, maybe $100 flat fee if it's basically an overgrown business card. Why? The very fact that you're wondering about prices and getting nervous about the project speaks volumes about your lack of experience (nothing personal, you got to start somewhere). It's been my personal experience that "selling yourself short" when you first get into something is ideal. You won't feel as pressured to perform well in uncharted territory. Customer won't lose out as much if you get cold feet and bail. From customer's point of view, if they pay standard prices, they expect the standard. If I go to a barber shop, I expect a haircut from someone who knows how to cut hair, not someone training. Or being worked on by a student nurse/dentist/whatever. Why should you be the guinea pig and still have to pay normal prices? You can tell the customer up front that you aren't charging normal prices, so he won't be as disappointed if it turns out you suck or bail or whatever. And he (being your dad's friend, such and all), may very well give you extra if the job turns out good, because he'd know that you charged him less than the norm. And also, your dad is presumably trying to hook a friend up, and it kind of defeats the purpose of hooking friends up if you charge them standard prices.
-
My thoughts: I usually don't vote, because I do not believe in picking the lesser of the two evils. For some reason, many people readily admit that it is indeed a lesser of the two evils choice, but go ahead and vote anyways. To me, that's just silly. If I had to choose between eating razor blades or monkey turd, I would give both the finger. So why the hell are other people freely admitting both choices suck, but happily start scooping up handfuls of one and shoving it down their throat? Evil is evil. And I use "evil" as an ambiguous term, because that's how the axiom goes. Feel free to swap it out for ignorant, liars, stupids, retarded, etc... So from this perspective, I really didn't care who won. Both guys always promise the moon and stars and then promptly do whatever the big companies tell them to do. It's the same old re-run every single time. I'm glad we finally have a black president. That way, when he fails to deliver, just like every other president, maybe people will finally stop trying to claim America is failing because we always have old white guys in charge. Maybe then, people will start figuring out what the real problems are. And statements like "Electing a black president, when we used to be racist slave owners, is a significant achievement," prove my point. Sure, it's something to look at, big change such and all, but seriously, wtf does that have anything to do with his ability to do the job? Makes me wonder how many people really did vote for Obama just because he's black. Now I'm not saying he was the worse of the two evils. People choose the "right" things for the wrong reasons all the time. It's called making an uninformed decision based off something stupid, and getting lucky. Speaking of failing to deliver: taxing the rich. Taxing the rich isn't going to do a damn thing to the rich. They're rich, they can afford it. That's the point of being rich: having a bunch of extra money. All it's going to do is make them more pissy. On the other hand, it's going to hurt the poor. Unlike the rich, the poor people don't have a bunch of extra money. In fact, they usually have less money than what it takes to live off of. They usually end up getting government assistance. That's the whole idea of being poor: no money. So how do you think the rich guy is going to respond, when Uncle Sam starts taking more of their money? They're going to turn around and raise prices on whatever they're selling. Way to go. I think it's funny that you stereotype poor people like that. Are you really so naive to suppose that all poor people are druggies that don't want to work? Or that rich people don't do drugs? You are a fool. Oh and you're also a fool if you think this whole tax the rich thing is some kind of robin hood policy. It most certainly is not about taking from the rich and giving to the poor.